Beispiel #1
0
        /// <summary>
        /// 因为用ROW_NUMBER() Over(Order By XXX) As RowNum,所以OrderBy参数必须有值
        /// </summary>
        public DataTable SearchByCriteria(string TableName, int CurrentPage, int PageSize,
                                          out int RecordCount, string Filter, string OrderBy)
        {
            DataTable dt = new DataTable();
            int       PageCnt = 0, RCnt = 0;

            SqlParameter[] parms = new SqlParameter[] {
                new SqlParameter("@Columns", "*"),
                new SqlParameter("@TableName", TableName),
                new SqlParameter("@Condition", Filter),
                new SqlParameter("@OrderBy", OrderBy),
                new SqlParameter("@PageNum", CurrentPage + 1),
                new SqlParameter("@PageSize", PageSize),
                new SqlParameter("@PageCount", PageCnt),
                new SqlParameter("@RecordCount", RCnt)
            };
            parms[6].Direction = ParameterDirection.Output;
            parms[7].Direction = ParameterDirection.Output;
            DBExtBase.ExeBySP(this.dataCtx, dt, "usp_GetPageData", parms);
            RecordCount = (int)parms[7].Value;

            return(dt);
        }