Exemplo n.º 1
0
 public DataTable FindTable(string strSql, DbParameter[] dbParameter)
 {
     using (var dbConnection = dbcontext.Database.Connection)
     {
         var IDataReader = new DbHelper(dbConnection).ExecuteReader(CommandType.Text, strSql, dbParameter);
         return(ConvertExtension.IDataReaderToDataTable(IDataReader));
     }
 }
Exemplo n.º 2
0
 public DataTable FindTable(string strSql, DbParameter[] dbParameter, string orderField, bool isAsc, int pageSize, int pageIndex, out int total)
 {
     using (var dbConnection = dbcontext.Database.Connection)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append(new DatabasePage().SqlPageSql(strSql, dbParameter, orderField, isAsc, pageSize, pageIndex));
         total = Convert.ToInt32(new DbHelper(dbConnection).ExecuteScalar(CommandType.Text, "Select Count(1) From (" + strSql + ") t ", dbParameter));
         var       IDataReader = new DbHelper(dbConnection).ExecuteReader(CommandType.Text, sb.ToString(), dbParameter);
         DataTable resultTable = ConvertExtension.IDataReaderToDataTable(IDataReader);
         return(resultTable);
     }
 }