Beispiel #1
0
 public CommandInfo(DataConnection dataConnection, string commandText, DataParameter parameter)
 {
     DataConnection = dataConnection;
     CommandText    = commandText;
     Parameters     = new[] { parameter };
 }
Beispiel #2
0
 /// <summary>
 ///  带一个参数执行sql语句返回DataReader
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="sql">sql语句</param>
 /// <param name="parameter">单个参数</param>
 /// <returns></returns>
 public static DataReader ExecuteReader(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).ExecuteReader());
 }
Beispiel #3
0
 /// <summary>
 /// 执行带有参数的存储过程  返回结果集
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="connection"></param>
 /// <param name="sql"></param>
 /// <param name="parameter">单个DataParameter对象</param>
 /// <returns>IEnumerable</returns>
 public static IEnumerable <T> Query <T>(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).Query <T>());
 }
Beispiel #4
0
 /// <summary>
 /// 带一个参数执行sql语句返回单个结果
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="connection"></param>
 /// <param name="sql">sql语句</param>
 /// <param name="parameter">单个参数</param>
 /// <returns></returns>
 public static T Execute <T>(this DataConnection connection, string sql, DataParameter parameter)
 {
     return(new CommandInfo(connection, sql, parameter).Execute <T>());
 }
 public static CommandInfo SetCommand(DataConnection dataConnection, string commandText, DataParameter parameter)
 {
     return(new CommandInfo(dataConnection, commandText, parameter));
 }