private void PrepareCommand(ComCommand cmd, CommandType commandType, string commandText, Param commandParameters) { cmd.CommandType = commandType; cmd.CommandText = commandText; cmd.Connection = this._dbconn; if (trans == null) { cmd.Transaction = null; } else { cmd.Transaction = trans.Transaction; } if ((commandParameters != null) && (commandParameters.Count > 0)) { for (int i = 0; i < commandParameters.Count; i++) { cmd.Parameters.Add(commandParameters[i].ParameterName, commandParameters[i].Value); } } }
public ComDataReader ExecuteReader(CommandType commandType, string commandText, Param commandParameters) { ComCommand cmd = new ComCommand(); PrepareCommand(cmd, commandType, commandText, commandParameters); ComDataReader dr = cmd.ExecuteReader(); cmd.Parameters.Clear(); cmd.Dispose(); return(dr); }