Beispiel #1
0
 public static SqlDataReader GetDataReader(SelectHelper selectHelper, string connectionStr = "")
 {
     SqlDataReader dataReader;
     using (SqlCommand sqlCmd = CreateSqlCmd(selectHelper.Sql, selectHelper.SqlParameters,connectionStr)) {
         dataReader = sqlCmd.ExecuteReader();
     }
     return dataReader;
 }
Beispiel #2
0
 public static int GetRecordCount(SelectHelper selectHelper, string connectionStr = "")
 {
     using (SqlCommand sqlCmd = CreateSqlCmd(selectHelper.Sql, selectHelper.SqlParameters,connectionStr)) {
         object obj = sqlCmd.ExecuteScalar();
         return obj.ToInt();
     }
 }
Beispiel #3
0
 public static DataTable GetDataTable(SelectHelper selectHelper, string connectionStr = "")
 {
     DataTable dt = new DataTable();
     using (SqlCommand sqlCmd = CreateSqlCmd(selectHelper.Sql, selectHelper.SqlParameters,connectionStr)) {
         using (SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCmd)) {
             dataAdapter.Fill(dt);
         }
         return dt;
     }
 }