以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Dot NET,C#,ASP,VB 』  (http://bbs.xml.org.cn/list.asp?boardid=43)
----  求助:记录集错误  (http://bbs.xml.org.cn/dispbbs.asp?boardid=43&rootid=&id=28390)


--  作者:xXYXx
--  发布时间:3/10/2006 10:25:00 AM

--  求助:记录集错误
<%
lfname="aa"

set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("gg.mdb")

select case lfname
case "aa"

set rs1=server.createobject("adodb.recordset")
exec="select * from gg where gm='"&sh&"'"
rs1.open exec,conn,2,3
while not rs1.eof or rs1.bof
response.Write(rs1("gm"))
  rs1.movenext
wend
'response.Write(rs1("gm"))

case "AA"

set rs1=server.createobject("adodb.recordset")
exec="select * from gg where gm='"&sh&"'"
rs1.open exec,conn,2,3

while not rs1.eof or rs1.bof
response.Write(rs1("gm"))
  rs1.movenext
wend
case else

set rs1=server.createobject("adodb.recordset")
exec="select * from gg where tbtype=2 order by date desc"
rs1.open exec,conn,2,3
while not rs1.eof or rs1.bof
response.Write(rs1("gm"))
  rs1.movenext
wend
end select

%>
执行上面的代码,出现如下错误提示:
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
可是我实在看不出哪错了,到底哪错了呢?


--  作者:supnate
--  发布时间:3/10/2006 2:05:00 PM

--  
while not rs1.eof or rs1.bof
response.Write(rs1("gm"))
  rs1.movenext
wend
只要写成
while not rs1.eof就可以了
--  作者:xXYXx
--  发布时间:3/11/2006 10:16:00 AM

--  
我去掉了,还是不行,运行后屏幕是一片空白?
--  作者:supnate
--  发布时间:3/11/2006 5:16:00 PM

--  
不提示出错了?
那检查一下sql语句,或者数据库是否为空
--  作者:xXYXx
--  发布时间:3/13/2006 9:08:00 AM

--  
SQL 语句我看了很多遍了,没什么问题啊,数据库里也有数据啊,我听说必须是每个字段里都有数据,所以我又把所有的字段都设置了默认值,还是不行
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
78.125ms