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

  • 相关阅读:
    Windows 10 win 10 切换输入法的快捷键
    windows 7输入regedit 打不开注册表
    ios开发之NSData
    ios数组倒序
    iOS NSString使用stringWithFormat的拼接
    BLE 广播格式定义
    低功耗蓝牙UUID三种格式转换
    iOS 如何判断一个点在某个指定区域中
    iOS 毛玻璃效果的实现方法
    iOS毛玻璃效果的实现方法
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1709475.html
Copyright © 2011-2022 走看看