Thursday, 14 July 2011

Using stored procedures

SqlConnection mConnection = new SqlConnection(mConnectionString);
SqlCommand mCommand = new SqlCommand();
try
{
//Update with Web Response
mCommand = new SqlCommand("spi_Error");
mCommand.CommandType = CommandType.StoredProcedure;
mCommand.Parameters.Add(new SqlParameter("@Message", ErrorString));
mCommand.Parameters.Add(new SqlParameter("@RowNumber", ParameterDirection.Output));


//mCommand.Transaction = mTransaction
mConnection.Open();
mCommand.Connection = mConnection;
mCommand.ExecuteNonQuery();