统计会员在线时间不能写入数据库问题 高分求解

Sorbety3105 2012-04-26 10:54:21
我用3个文件来完成 一个是登陆界面 输入账号和密码
一个是处理页面 代码如下
<!-- #INCLUDE file="../share/connectdb.asp" -->
<%dim strname,strpassword,msg,msg1,msg2
strname=trim(Request.Form("wymc"))
strpassword=Request.Form("wykl")
set rswy=server.CreateObject("ADODB.Recordset")
sqlwy="select * from wyb where wymc='"&strname&"' and wykl='"&strpassword&"'"
rswy.Open sqlwy,conn,3,3

msg1="用户或口令错误!"
msg2="您还不是正式会员,没有会员发布和修改信息的权限!"

if not rswy.eof then
set session("member")=rswy
set rswy=nothing
else
Response.Redirect "error.asp?msg="&msg1&""
end if

if session("member")("wyjb")=0 then
Response.Redirect "error.asp?msg="&msg2&""
end if

if session("member")("sshy")=1 then
set session("time1")=now()
set session("wymc")=wymc
Response.Redirect "../default.asp"
else
set session("time1")=now()
set session("wymc")=wymc
Response.Redirect "../default.asp"
end if
set conn=nothing
%>
还有一个自动刷新页面 代码如下
<!--#include file="../share/connectdb.asp"-->
<%
If DateDiff("s",session("time1"),Now())<50 Then
URL=Request.ServerVariables("Http_REFERER")
Response.Write("<meta http-equiv=""refresh"" content=""2;URL="&URL&""">")
Response.Write("")
Response.End
End IF
'目前数据量比较小,所以60秒刷新一次。
wymc=session("wymc")
set rss=server.CreateObject("adodb.recordset")
sqls="select * from wyb where wymc='"&wymc&"'"
rss.open sqls,conn,3,3
rss.addnew
if not rss.eof and rss.bof then


time=rs("time")
time=time+1
Conn.Execute("update wyb set time= '"&time&"' where wymc='"&wymc&"'")

rss.close
end if
%>
<html>
<head>
<META http-equiv=refresh content=60>
<META http-equiv=Pragma content=no-cache>
</head>
<body>
</body>
</html>
怎么数据库wyb表的time字段(数字类型)写入不了啊
...全文
158 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sorbety3105 2012-04-26
  • 打赏
  • 举报
回复
还是不行啊
三石-gary 2012-04-26
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]

是去掉双引号 还是 单引号? 谢谢回答啊
[/Quote]
去掉单引号试试
Sorbety3105 2012-04-26
  • 打赏
  • 举报
回复
是去掉双引号 还是 单引号? 谢谢回答啊
三石-gary 2012-04-26
  • 打赏
  • 举报
回复
Conn.Execute("update wyb set time= '"&time&"' where wymc='"&wymc&"'")
time 是数据类型就不用加引号。。
update wyb set time= '1' where wymc='sdfsd'
就成这样了。。不知道是不是这个原因
Sorbety3105 2012-04-26
  • 打赏
  • 举报
回复
高手都出来啊 大哥帮个忙啊
Sorbety3105 2012-04-26
  • 打赏
  • 举报
回复
rss.update
我加了 还是不行啊
挨踢直男 2012-04-26
  • 打赏
  • 举报
回复
sqls="select * from wyb where wymc='"&wymc&"'"
rss.open sqls,conn,3,3
rss.addnew
if not rss.eof and rss.bof then


time=rs("time")
time=time+1
Conn.Execute("update wyb set time= '"&time&"' where wymc='"&wymc&"'")
rss.update
rss.close
end if
------------------------
看一下是不是这个原因
Sorbety3105 2012-04-26
  • 打赏
  • 举报
回复
我是60秒自动刷新的 time是数字类型 初始值是0,刷新一次 +1变成1
三石-gary 2012-04-26
  • 打赏
  • 举报
回复
time=rs("time")
time=time+1
Conn.Execute("update wyb set time= '"&time&"' where wymc='"&wymc&"'")
看看这个时间加1之后还是不是时间类型的。。不是的话把它转为时间类型

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧