首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

not(oRs.EOF or oRs.BOF) 不起作用

2012-02-07 
not(oRs.EOF or oRs.BOF)不起作用在线等看看我的问题什么地方出错了,没有记录也运行,就好像not(oRs.EOF or

not(oRs.EOF or oRs.BOF) 不起作用 在线等
看看我的问题什么地方出错了,没有记录也运行,就好像not(oRs.EOF or oRs.BOF) 不起作用 是那写错了

HTML code
<%text=request("text")    If IsObject(oConn) = False Then     Set oConn = Server.CreateObject("ADODB.Connection")    On Error Resume Next    ' Access数据库    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("dwefb/iedifdfc.mdb")    If Err.Number > 0 Then    response.Write("出错了")            Response.End    End If    end if    sSql = "select * from tihuan where text1=abc"    response.Write(sSql)    oRs.Open sSql, oConn, 1, 1    If not(oRs.EOF or oRs.BOF) Then        retext=oRs("text2")        response.Write("找到了"&retext)    Else        retext="没有找到"        response.Write(retext)    End If    oRs.Close    %>


sSql = "select * from tihuan where text1=abc" 怎么改都是一样的情况


[解决办法]
没有记录的判断是用and
if not(oRs.eof and oRs.bof) then
...
[解决办法]
not oRs.eof 或者not oRs.eof and oRs.bof 表示有记录
oRs.eof and oRs.bof 表示没记录

not(oRs.eof or oRs.bof) 你的这个理解就是错误的 括号里面的是true false 如何进行or或者逻辑判断
[解决办法]
捕捉下error, 看看description是什么.
[解决办法]
oRs.eof表示记录在尾--空
oRs.bof表示记录在头--空
if not (ors.eof and ors.bof) then
do while not ors.eof
xxxxx
ooooo
ors.movenext
loop
end if

if not (ors.eof and ors.bof) then
response.Write("找到了"&retext)
end if
if (ors.eof and ors.bof) then
response.Write("没有找到"&retext)
end if


如果是多行用上面写。

判断记录集是否一第也没有要用AND呀。

热点排行
Bad Request.