1
私はちょうどSQLHelperクラスV2のコードを閲覧していると私は気付か次SQLHelperクラス - は、ExecuteNonQueryコード変更
public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
{
if(transaction == null) throw new ArgumentNullException("transaction");
if(transaction != null && transaction.Connection == null) throw new ArgumentException("The transaction was rollbacked or commited, please provide an open transaction.", "transaction");
// Create a command and prepare it for execution
SqlCommand cmd = new SqlCommand();
bool mustCloseConnection = false;
PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters, out mustCloseConnection);
// Finally, execute the command
int retval = cmd.ExecuteNonQuery();
// Detach the SqlParameters from the command object, so they can be used again
cmd.Parameters.Clear();
return retval;
}
コマンドは、「使用Bolck」内なかった理由はありますか?私はコード内のどこかで "Using Block"の使用を見ています。
このコードはどこにありますか? SQLHelperとは何ですか? – JoshBerke
はい、そうです。どうして? –