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();
        }

  • 相关阅读:
    SDOI Day2
    SDOI Day1
    Codeforces 506E Mr. Kitayuta's Gift (矩阵乘法,动态规划)
    CEOI 2014 wall (最短路)
    BZOJ 3926: [Zjoi20150]诸神眷顾的幻想乡(后缀自动机)
    BZOJ 3925: [Zjoi2015]地震后的幻想乡(概率)
    BZOJ 3924: [Zjoi2015]幻想乡战略游戏(动态点分治)
    Nginx与Lua的开发
    Nginx访问控制
    Nginx模块
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1709475.html
Copyright © 2011-2022 走看看