Beispiel #1
0
 private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters)
 {
     if (connection.State != ConnectionState.Open)
     {
         connection.Open();
     }
     command.Connection  = connection;
     command.CommandText = commandText;
     if (transaction != null)
     {
         command.Transaction = transaction;
     }
     command.CommandType = commandType;
     if (commandParameters != null)
     {
         SqlHelper.AttachParameters(command, commandParameters);
     }
 }