limaidang

使用aspnetpager控件
下载地址http://www.webdiyer.com/download/default.aspx
string mysql = "select count(*) from xueshengkaohe"//计算有多少条数据
SqlCommand cmd = new SqlCommand(mysql, con);//执行sql语句
recordcount = (int)cmd.ExecuteScalar();//定义一个记录数据条数的变量并赋值
AspNetPager1.RecordCount = recordcount;// 给aspnetpager控件赋值
sda.Fill(ds, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "xueshengkaohe");
//在填充是再写上这两条数据
Gridview1.datasouce=ds;
Gridview1.DataBind();
哈哈,OK了!
这样就可以使用分页了,太简单了。

分类:

技术点:

相关文章:

  • 2021-07-17
  • 2021-09-15
  • 2021-11-21
  • 2021-11-29
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2021-07-04
  • 2021-12-05
  • 2021-11-21
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
相关资源
相似解决方案