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


Please Help Members By Posting Answers For Below Questions

Compare Data Reader & Dataset in ado.net?

746


What is sqldatasource?

709


Define different execute methods of ADO.NET command object ?

753


What we do with the object of ado.net dataset after using it?

713


What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

789


What is the difference between SqlCommand and SqlCommandBuilder?

785


what is the difference betwen typed dataset and untyped dataset?in general which dataset can we use in programming?

748


What are the ado.net objects?

694


Explain the dataadapter class in ado.net?

874


What is difference between Dataview and Datatable?

736


Define table relations?

738


What is Data Provider?

795


What is the return type of executescalar?

710


What are the key features of ado.net?

863


What are the essential features of ado.net?

719