日期:2014-05-17  浏览次数:21196 次

判断出错啊!
messenger_read是数据库里记录信息是否已读,1是已读,但为什么以下的代码不能运行啊!


set   rs=server.CreateObject( "adodb.recordset ")
sql2= "select   messenger_read   from   messenger "
rs.open   sql2,conn,1,3
if   rs( "messenger_read ") <> "1 "   then
response.write( "你有新消息 ")
end   if
set   sql2=noting

------解决方案--------------------
你试一试这段代码嘛!

set rs=server.CreateObject( "adodb.recordset ")
sql2= "select messenger_read from messenger " '如果为多个管理员这里应加上 " where msg_Name= ' "&msg_name& " ' "不然也会导致结果不准确
set rs=conn.execute(sql2,,adcmdtext)
'rs.open sql2,conn,1,3
if Not rs.eof then
if rs( "messenger_read ") <> "1 " then
response.write " <script language= 'javascript '> window.alert( '你有新消息! '); </script> ")
end if
else
response.write " <script language= 'javascript '> window.alert( '无记录! '); </script> ")
end if
set sql2=noting
rs.close

当然这上边只是为了测试才用的弹出消息框,你可以写你自己的代码

------解决方案--------------------
set rs=server.CreateObject( "adodb.recordset ")
sql2= "select messenger_read from messenger "
set rs=conn.execute(sql2,,adcmdtext)
'rs.open sql2,conn,1,3
while Not rs.eof
if rs( "messenger_read ") <> "1 " then
response.write "你有新消息! "
end if
rs.movenext
wend
set sql2=nothing
rs.close

------解决方案--------------------
set rs=server.CreateObject( "adodb.recordset ")
真是个马大哈!
sql2= "select messenger_read from messenger "
set rs=conn.execute(sql2)
while Not rs.eof
if rs.fields( "messenger_read ") <> "1 " then
response.write "你有新消息! "
end if
rs.movenext
wend
set sql2=nothing
rs.close