代码:
///
/// 执行SQL,返回DataReader对象
///
///
///
///
public System.Data.IDataReader ExcuteDataReader(string cmdText, System.Collections.IEnumerable parameters)
{
IDataReader dataReader = null;
IDbConnection connection = CreateDbConnection();
//Command
IDbCommand command = new MySqlCommand(cmdText);
IDbCommand commandTimeout = new MySqlCommand("set net_write_timeout=99999;set net_read_timeout=99999");
commandTimeout.Connection = connection;
commandTimeout.ExecuteNonQuery();
command.Connection = connection;
PreDbCommand(command, parameters);
//
dataReader = command.ExecuteReader(CommandBehavior.CloseConnection);
//创建Command
return dataReader;
}