Call a stored procedure from ado.net and pass parameter to it ?
Answer Posted / suman zalodiya
SqlConnection con = new SqlConnection("Your Databse
Connection String");
SqlCommand cmd = new SqlCommand("Stored Procedure Name",
con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@source", SqlDbType.VarChar, 50).Value
= TextBox1.Text;
cmd.Parameters.Add("@destination", SqlDbType.VarChar,
50).Value = TextBox2.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is ado oledb and odbc?
How many major types of connection objects in ADO.NET?
What is ado.net full form?
What are advantages of microsoft-provided data provider classes in ado.net?
What is a dynaset in access?
Explain the difference between sqlcommand object and command behavior object?
What is ado connection?
What is the use of Dataview?
What is datatable in ado.net?
describe the dataset object in ado.net.
What are all the different authentication techniques used to connect to MS SQL Server?
What are all the classes that are available in System.Data Namespace?
What provider ado.net use by default? Explain the role of data provider in ado.net? What is the role of data provider in ado.net?
Why is stored procedure used in ado.net?
What is dbcontext and dbset in entity framework?