/// <summary> /// 获得指定Sql语句查询下的数据集 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>数据集</returns> public DataSet ExecuteDataSet(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } return(this.ExecuteDataSet(command.ToDbCommand())); }
/// <summary> /// 获得指定Sql语句查询下的数据读取器 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>数据读取器</returns> public IDataReader ExecuteReader(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } return(this.ExecuteReader(command.ToDbCommand())); }
/// <summary> /// 返回执行指定Sql语句后影响的行数 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>受影响的行数</returns> public Int32 ExecuteNonQuery(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } return(this.ExecuteNonQuery(command.ToDbCommand())); }
/// <summary> /// 返回执行指定Sql语句后返回的结果 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>返回的结果</returns> public Object ExecuteScalar(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } return(this.ExecuteScalar(command.ToDbCommand())); }
/// <summary> /// 根据Sql语句创建数据库命令 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>数据库命令</returns> public DbCommand CreateDbCommand(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } return(command.ToDbCommand()); }
/// <summary> /// 返回执行指定Sql语句后返回的结果 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="command">指定Sql语句</param> /// <param name="dataType">数据类型</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>返回的结果</returns> public T ExecuteScalar <T>(ISqlCommand command, DataType dataType) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteScalar <T>(dbCommand, dataType)); }
/// <summary> /// 返回执行指定Sql语句后返回的结果 /// </summary> /// <typeparam name="T">数据类型</typeparam> /// <param name="command">指定Sql语句</param> /// <param name="connection">数据库连接</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>返回的结果</returns> public T ExecuteScalar <T>(ISqlCommand command, DbConnection connection) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteScalar <T>(dbCommand, connection, null)); }
/// <summary> /// 获得指定Sql语句查询下的单行数据 /// </summary> /// <param name="command">指定Sql语句</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>单行数据</returns> public DataRow ExecuteDataRow(ISqlCommand command) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteDataRow(dbCommand)); }
/// <summary> /// 获得指定Sql语句查询下的数据表 /// </summary> /// <param name="command">指定Sql语句</param> /// <param name="transaction">数据库事务</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>数据表</returns> public DataTable ExecuteDataTable(ISqlCommand command, DbTransaction transaction) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteDataTable(dbCommand, null, transaction)); }
/// <summary> /// 获得指定Sql语句查询下的数据读取器 /// </summary> /// <param name="command">指定Sql语句</param> /// <param name="connection">数据库连接</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>数据读取器</returns> public IDataReader ExecuteReader(ISqlCommand command, DbConnection connection) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteReader(dbCommand, connection, null)); }
/// <summary> /// 返回执行指定Sql语句后影响的行数 /// </summary> /// <param name="command">指定Sql语句</param> /// <param name="connection">数据库连接</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>受影响的行数</returns> public Int32 ExecuteNonQuery(ISqlCommand command, DbConnection connection) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteNonQuery(dbCommand, connection, null)); }
/// <summary> /// 返回执行指定Sql语句后返回的结果 /// </summary> /// <param name="command">指定Sql语句</param> /// <param name="transaction">数据库事务</param> /// <exception cref="ArgumentNullException">Sql语句不能为空</exception> /// <returns>返回的结果</returns> public Object ExecuteScalar(ISqlCommand command, DbTransaction transaction) { if (command == null) { throw new ArgumentNullException("command"); } DbCommand dbCommand = command.ToDbCommand(); return(this.ExecuteScalar(dbCommand, null, transaction)); }