asp.net中的sql分页
string sqlAll="SELECT *FROM system_var";
this.ListView1.DataSource = DBHelper.GetDataSet(sqlAll).Tables[0];
this.ListView1.DataBind();
如果进行分页?不要用ListView自带的分页,因为数据量很大。
我的数据库的mysql数据库 asp.net sql
[解决办法]
select * from(SELECT *,row=row_number()over(order by getdate()) FROM [tablename])t where row between @X and @Y
[解决办法]
SELECT * FROM table LIMIT m,n
其中m是指记录开始的index,n是指从第m+1条开始,取n条。如5,10取的记录行 6-15
[解决办法]
int pagesize = 10;
int currentpage=0;
string sqlAll="分页sql";
string sqlCount = "获取数量sql";
this.ListView1.DataSource = DBHelper.GetDataSet(sqlAll).Tables[0];
this.ListView1.DataBind();
int totalCount = (int)DBHelper.ExecuteScalar(sqlAll);
this.aspnetpager.PageSize = pagesize ;
this.aspnetpager.PageIndex=currentpage;
this.aspnetpager.Count = totalCount ;
大概就这样吧,凭记忆写的,只能作参考