Thursday, August 20, 2009

Execute the stored procedure with parameters.

SqlConnection sqlConn = new SqlConnection("...");
sqlConn.Open();

SqlCommand command= new SqlCommand("stored_procedure_name", sqlConn);
command.CommandType = CommandType.StoredProcedure;

// add parameter
command.Parameters.AddWithValue("@id", id);


int affectedRows = command.ExecuteNonQuery();

1 comment:

SI said...

hey you have a nice blog
but plz add subscribe or follow me buttons so that we can keep a track of ur posts
thnks
Aman