Hi,
The procedure is the same as executing the command text in a manner.
The following is an example calling the Procedure:
conn = new SqlConnection(ConnectionString);
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "proaa"; // the name of procedure in the SQL Server
SqlParameter[] par = new SqlParameter[1];
par[0] = new SqlParameter("@ID",SqlDbType.Int);
par[0].Direction = ParameterDirection.Input;
par[0].Value = 1;
comm.Parameters.AddRange(par);
adapter = new SqlDataAdapter(comm);
dataset = new DataSet();
adapter.Fill(dataset,"dt01");
dataGridView1.DataSource = dataset;
dataGridView1.DataMember = "dt01";
The following link is for your reference:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET
If I misunderstood you, or you have other questions, please feel free to tell me.
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.