问题描述
<%myconn.execute("deletefrom[website].[dbo].[online]whereltime<Getdate()-0.005")lgname=Request.Cookies(cn)("lgname")//提示这行出错,我是将access数据库程序转换成sqlserver程序才出现这样的错误ip=request.servervariables("remote_addr")iflgname=""thensetjilu=myconn.execute("selectipfrom[website].[dbo].[online]whereip='"&ip&"'")ifjilu.eofthensetjilu=nothingmyconn.execute("insertinto[website].[dbo].[online](ip,ltime)VALUES('"&ip&"','"&Getdate&"')")elsemyconn.execute("update[website].[dbo].[online]setltime='"&Getdate&"'whereip='"&ip&"'")endifendififlgname<>""thensetujilu=myconn.execute("selectnamefrom[website].[dbo].[online]wherename='"&lgname&"'")ifujilu.eofthensetujilu=nothingmyconn.execute("delete*from[website].[dbo].[online]whereip='"&ip&"'")myconn.execute("insertinto[website].[dbo].[online](name,ltime)VALUES('"&lgname&"','"&Getdate&"')")elsemyconn.execute("update[website].[dbo].[online]setltime='"&Getdate&"'wherename='"&Getdate&"'")endifendifusno=myconn.execute("Selectcount(ltime)from[website].[dbo].[online]wherename<>''")(0)lineno=myconn.execute("Selectcount(ltime)from[website].[dbo].[online]")(0)iflineno>mostonlinethenmyconn.execute("update[website].[dbo].[bbsinfo]setmostonline='"&lineno&"'")mostonline=linenoendifnusno=lineno-usno%>
解决方案
解决方案二:
之前你的cookie是否存入值lgname=Request.Cookies(cn)("lgname")
解决方案三:
cn是变量吗?是变量的话有没有值?