using
に使用したいsql command
:
using(SqlCommand command = new SqlCommand("usp_UpdateUser", _sqlConnection, _sqlTransaction))
{
....
}
しかし、FillCommand(ref command)
例外が発生しています:
Cannot pass command as ref or out variable because it is using variable.
私のコードは次のとおりです。
SqlCommand command = new SqlCommand("usp_UpdateUser", _sqlConnection,
_sqlTransaction);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int)).Value = Id;
FillCommand(ref command);
try
{
command.ExecuteNonQuery();
}
catch
{
throw;
}