1、select top 1000 * from 表A
'获取要显示的页
Dim page As Integer = 0 '默认page为0,显示第一页
Dim pageRows As Integer = 10 '每页10行
If e.GetValues.ContainsKey("page") Then '如果地址中有page参数
Integer.TryParse(e.GetValues("page"), page) '提取page参数
End If
Dim StartRow As Integer = page * pageRows + 1 '此页第一行
Dim EndRow As Integer = (page + 1) * pageRows '此页最后一行
'获取该页数据
Dim cmd As New SQLCommand
cmd.Connecti '记得设置数据源名称
cmd.CommandText = "Select Count(*) From {订单}"
Dim Count As Integer = cmd.ExecuteScalar() '获取总的行数
Dim Pages As Integer = Math.Ceiling(Count/PageRows) '计算出总页数
cmd.CommandText = "Select * From (Select Row_Number() Over(Order by 订单.订单编号 desc ) As RowNum,订单.订单编号,日期,客户,Sum(数量) As 数量,sum(数量*单价) As 金额"
cmd.CommandText = cmd.CommandText & " From 订单 Left JOIN 订单明细 ON 订单明细.订单编号 = 订单.订单编号 Group By {订单}.订单编号,日期,客户) As a "
cmd.CommandText = cmd.CommandText & " Where RowNum >= " & StartRow & " And RowNum <= " & EndRow
Dim dt As DataTable = cmd.ExecuteReader