存储过程通用DAL类查询分页数据返回datatable

DAL


#region 查询分页数据 public DataTable SelectPageing(string feids, int page, int pagesize, int paixu, string where, string paixufeids, string tablename) { SqlParameter[] parms = new SqlParameter[] { new SqlParameter("@FEILDS",SqlDbType.NVarChar,1000), new SqlParameter("@PAGE_INDEX",SqlDbType.Int,10), new SqlParameter("@PAGE_SIZE",SqlDbType.Int,10), new SqlParameter("@ORDERTYPE",SqlDbType.Int,2), new SqlParameter("@ANDWHERE",SqlDbType.VarChar,1000), new SqlParameter("@ORDERFEILD",SqlDbType.VarChar,100), new SqlParameter("@TABLENAME",SqlDbType.VarChar,100) }; parms[0].Value = feids;//获取所有的字段 parms[1].Value = page;//当前页面索引 parms[2].Value = pagesize;//页面大小 parms[3].Value = paixu;//升序排列 parms[4].Value = where;//条件语句 parms[5].Value = paixufeids;//排序字段 parms[6].Value = tablename;//表名 DataTable dt = new DataTable(); using (SqlDataReader sdr = DBTool.DB.ExecuteReader(CommandType.StoredProcedure, "PAGINATION", parms)) { dt.Load(sdr); } return dt; } #endregion



  BLL

 #region  查询分页数据
        public DataTable SelectPageing(string feids, int page, int pagesize, int paixu, string where, string paixufeids, string tablename)
        {
            return new HZ.DAL.SelectPage().SelectPageing(feids,page,pagesize,paixu,where,paixufeids,tablename);
        }
        #endregion

  

你可能感兴趣的:(存储过程通用DAL类查询分页数据返回datatable)