• 本人自写代码(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();
        }

  • 相关阅读:
    tomcat配置数据源
    Spring 配置详解
    典型的软件开发模型
    600字让你读懂Git
    JVM的自愈能力
    Maven的pom.xml文件详解
    如何使用Log4j
    掌握jQuery插件开发,这篇文章就够了
    CSS Gradient详解
    CSS Transition
  • 原文地址:https://www.cnblogs.com/chenbg2001/p/1709475.html
Copyright © 2020-2023  润新知