pass textbox value to storedprocedure

  • Thread starter Thread starter jed
  • Start date Start date
J

jed

I need to pass a value that is inserted by the user in a textbox to a
variable in my stored procedure. please help
 
Well i have declared a variable in SQLExpress and need to assign the
value to it.i am
a newbie and am not sure how to start.should i create a connection to
sql in code then open the connection and try access it through there
 
Well i have declared a variable in SQLExpress and need to assign the
value to it.i am
a newbie and am not sure how to start.should i create a connection to
sql in code then open the connection and try access it through there

very simple

this.SqlCommand = new SqlCommand("myProcedureName",
this.SqlConnection);
this.SqlCommand.CommandType = CommandType.StoredProcedure;

this.SqlCommand.Parameters.Add("@variableName1",
SqlDbType.VarChar).Value = variableValue1;
this.SqlCommand.Parameters.Add("@variableName2",
SqlDbType.Int).Value = variableValue2;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top