An example on how to execute a stored procedure in ADO.NET..

Bharathi Cherukuri
Posted by Bharathi Cherukuri under ASP.NET category on | Points: 40 | Views : 1091
Here is an example to execute a stored procedure in ADO.NET.

using (SqlConnection ConnectionObject = new SqlConnection())
//Specify the name of the stored procedure to execute and the Connection Object to use
SqlCommand CommandObject = new SqlCommand("StoredProcedureName", ConnectionObject);
//Specify the SQL Command type is a stored procedure
CommandObject.CommandType = CommandType.StoredProcedure;
//Open the connection
//Execute the Stored Procedure
int RecordsAffected = CommandObject.ExecuteNonQuery();

Comments or Responses

Login to post response