AspNetPager分页控件使用方法

来源:互联网 发布:北京军工软件 编辑:程序博客网 时间:2024/04/30 21:46

 #region AspNetPagerQuerySql
        /// <summary>
        /// AspNetPagerQuerySql
        /// </summary>
        /// <param name="PageIndex">Index Page</param>
        /// <param name="PageSize">Page Size</param>
        /// <param name="Sql">Sql String</param>
        /// <param name="srTable">TableName</param>
        /// <param name="error">errorInfomation</param>
        /// <returns>DataSet</returns>
        public DataSet AspNetPagerQuerySql(int PageIndex, int PageSize, string Sql, string srTable, out string error)
        {
            error = null;
            DataSet ds = new DataSet();
            cmd.CommandText = Sql;
            sda = new OleDbDataAdapter(cmd);
            try
            {
                sda.Fill(ds, PageIndex * PageSize, PageSize, srTable);
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return ds;
        }
        #endregion

 

 

 #region AspNetPager
     /// <summary>
     ///
     /// </summary>
     /// <param name="PageIndex"></param>
     /// <param name="PageSize"></param>
     /// <param name="sErr"></param>
     /// <returns></returns>
      public static DataSet ViewCX(int PageIndex, int PageSize, out string sErr)
      {
        sErr = string.Empty;
        DataSet ds = null;
        OperateAccess OA = new OperateAccess();
        try
        {
          string sSql = string.Format(SqlLanguage.ViewCX);
          ds = OA.AspNetPagerQuerySql(PageIndex, PageSize, sSql, "TypeInfo", out sErr);

        }
        catch (Exception e)
        {
          sErr = e.Message;
          throw new Exception(sErr);
        }
        finally
        {
          if (OA != null)
            OA.Close();
        }
        return ds;
      }
      #endregion