top 0 本来就有点别扭,换成下面的得了。select ID from news where 1=2

解决方案 »

  1.   

    sql = "select top " & pagecount & " ID,newstitle,posttime,sortid,hits from info where id not in(select top " & pagecount * (Page - 1) & " ID from info where sortid=" & CID & " order by ID desc) and sortid=" & CID & " order by id desc"分页的时候如果Page=1就回出现 select top 0 在sql server里是没问题的 可在access就不行
      

  2.   

    加个
    if pagecount>0 then
     sql = "select top " & pagecount & " ID,newstitle,posttime,sortid,hits from info where id not in(select top " & pagecount * (Page - 1) & " ID from info where sortid=" & CID & " order by ID desc) and sortid=" & CID & " order by id desc"end if
      

  3.   

    语法错误。 在查询表达式 'id not in(select top 0 ID from info where sortid=1 order by ID desc) and sortid=1' 中。
      

  4.   

    If Page = 1 Then
                sql = "select top " & pagecount & " ID,newstitle,posttime,sortid,hits from info where sortid=" & CID & " order by id desc"
            Else
                sql = "select top " & pagecount & " ID,newstitle,posttime,sortid,hits from info where id not in(select top " & pagecount * (Page - 1) & " ID from info where sortid=" & CID & " order by ID desc) and sortid=" & CID & " order by id desc"
            End If这样解决了,不过 为什么select top 0 在Access会出错啊?
      

  5.   

    我刚刚在Access里面试过 没什么理由好说的 语法规定 SELECT TOP N (N>0)
      

  6.   

    TOP n [PERCENT] 
    Returns a certain number of records that fall at the top or the bottom of a range specified by an ORDER BY clause... 
    The value that follows TOP must be an unsigned Integer.
    就是正整数拉
      

  7.   

    你要知道 ACCESS使用的是JET SQL MSSQL使用的是TSQL 语法上有出入