易截截图软件、单文件、免安装、纯绿色、仅160KB

access分页sql

麻烦高手给写了access分页sql
string strPageSQL1 = "select top " + pageSize + " * from 表名 where 查询条件 order by id";
string strPageSQL2 = "select top " + pageSize + " * from 表名 where 查询条件 and id > (select max(id) from (select top " + pageSize * (pageIndex - 1) + " id from 表名 where 查询条件 order by id) as T) order by id";

第一页数据用第一句,第二页以后用第二句。
pageSize是每页的记录数
pageIndex是页码

一、Top

select * from Products where productid in
  ( select top 15 productid from
    ( select top 1499985 productname,productid from Products
        order by productid ) as t
      order by t.productid desc )

order by productid

二、Max

select top 15 * from Products
where productid>=
  (SELECT max(productid ) from
    (select top 2399986 productid from Products order by productid ) as t )

order by productid

引用
一、Top

select * from Products where productid in
  ( select top 15 productid from
    ( select top 1499985 productname,productid from Products
        order by productid ) as t
      order by t.productid desc )

order by productid

二、Max

se


相关问答:

VC连接ACCESS数据库问题 - VC/MFC / 数据库

问题1
我用ADO连接设了用户名密码的数据库
但是我发现我不输入 用户名和密码 都可以连接成功 而且还能把数据读出来
剪了一个名为test数据库 建了一个名为people的表 
见了一个 用户名1234 密码1234 的 ......

dwr Illegal access to default constructor错误

dwr.xml:
<create creator="struts" javascript="PrisonerActionForm">
  <param name="formBean" value="prisonerForm"/>
  < ......

用ASP 怎么将EXCEL导入到ACCESS - Web 开发 / ASP

问题是这样的,现在有一个工资表,是EXCEL的,我要把它导入ACCESS,因为 要查询每个人的工资,根据不同的编号可以查询到相对的人,
用ASP 怎么将EXCEL导入到ACCESS,而且每月都有不同的表,

引用
其实就是把EXCEL当成数 ......

查询ACCESS中符合条件记录的语法格式

我做了一个小程序,想实现的功能就是在文本框中输入姓名,点击查询按钮,就能查到ACCESS数据库中此学生的信息(编号,姓名,性别,年龄)可我不知道语法格式,我自己写的语句调试能通过,可是运行时出错(点击查询按 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号