zoukankan      html  css  js  c++  java
  • 本人自写代码(Aspnetpager详细介绍)

    DataSet ds;
        SqlDataAdapter dr;
        SqlCommand com;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shanxiConnectionString"].ConnectionString);
                com = new SqlCommand("select count(*) from Artist",con);
                con.Open();
                AspNetPager1.RecordCount=(int)com.ExecuteScalar();
           
                con.Close();
                bind();
            }
        }

        public void bind()
        {


            int count = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize;
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shanxiConnectionString"].ConnectionString);
            dr = new SqlDataAdapter("select * from Artist", con);
            ds = new DataSet();
            dr.Fill(ds, count, AspNetPager1.PageSize, "Artist");
          
            GridView1.DataSource = ds.Tables["Artist"];
            GridView1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            bind();
        }

  • 相关阅读:
    ApiDoc 一键生成注释
    质量报告之我见
    一些 ssh 小技巧
    virtualenv简介以及一个比较折腾的scrapy安装方法
    用scrapy数据抓取实践
    linux rootfs制作
    ubuntu环境下android开发环境安装
    弱符号 与 强符号, 强引用 与 弱引用
    链接器和加载器
    wine的使用
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1709475.html
Copyright © 2011-2022 走看看