回 帖 发 新 帖 刷新版面

主题:用循环,但显示数据库有漏记录的现象

请教,代码:
<%set rs=server.CreateObject("adodb.recordset")
   
    if lbdm=14 then     
     sql="select * from zxml2000 where yigaob<>0 or yigaox<>0 order by id asc"     
     elseif lbdm=23  then
     sql="select * from zxml2000 where erwanb<>0 or erwanx<>0 order by id asc"
     elseif  lbdm=12 then
     sql="select * from zxml2000 where yichub<>0 or yichux<>0 order by id asc"
     elseif  lbdm=22 then
     sql="select * from zxml2000 where erchub<>0 or erchux<>0 order by id asc"
     elseif  lbdm=32 then
     sql="select * from zxml2000 where sanchub<>0 or sanchux<>0 order by id asc"
    end if    
     rs.open sql,conn,1,1
     
     if not rs.eof and not rs.bof then
        i=1
     while not rs.eof and not rs.bof
     if lbdm=14 then
        bp=rs("yiwanb")
        xp=rs("yiwanx")
    elseif lbdm=23  then
         bp=rs("erwanb")
        xp=rs("erwanx")
    elseif lbdm=12  then
         bp=rs("yichub")
        xp=rs("yichux")
    elseif lbdm=22  then
         bp=rs("erchub")
        xp=rs("erchux")
    elseif lbdm=32  then
         bp=rs("sanchub")
        xp=rs("sanchux")
    end if
     %>

 
  <tr>
  
   
   
    <th scope="col">&nbsp;<%=rs("yiqibh")%></th>
    <th scope="col">&nbsp;<%=rs("mingcheng")%></th>
    <th scope="col">&nbsp;<%=rs("guigexh")%></th>
    <th scope="col">&nbsp;<%=rs("danwei")%></th>
    <th scope="col">&nbsp;<%=rs("cankaodj")%></th>
    <th scope="col">&nbsp;
      <%response.write(bp)%>
    </th>
    <th scope="col">&nbsp;
      <%response.write(xp)%>
    </th>
    <th scope="col">&nbsp;</th>
    <th scope="col">&nbsp;<%=rs("kedaiyyq")%></th>
    <th scope="col">&nbsp;<%=rs("beizhu")%></th>
    <th scope="col">&nbsp;<%=rs("kemu")%></th>
  </tr>
   <%rs.movenext
  i=i+1
  wend
  end if
  %>共<%response.Write(i)%>条

这里显示出来的i的记录数是908条,与access里实际存在的记录1315条相差很多。我检查了一下,漏掉的记录数没有规律,如从头开始分别是第7、11、10、11、19、48条。漏掉的记录也没有相同的特征。

谢谢指教。

回复列表 (共3个回复)

沙发


当然是了,你虽然用了循环,但你在SQL语句中限制了条件!

板凳

[quote]
当然是了,你虽然用了循环,但你在SQL语句中限制了条件![/quote]

但是我是按sql的条件来筛选的,也就是说,同样的筛选条件,我在access里筛选的结果与asp筛选的不一样。

3 楼

有解么?急

我来回复

您尚未登录,请登录后再回复。点此登录或注册