| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 724 人关注过本帖
标题:在线统计引用问题
只看楼主 加入收藏
kgdipbyve
Rank: 2
等 级:论坛游民
帖 子:346
专家分:35
注 册:2008-5-4
结帖率:92.31%
收藏
 问题点数:0 回复次数:2 
在线统计引用问题
<%
sessionID = session.SessionID
timeout =1
aaa = dateadd("n", -timeout, now())
connCount.Execute ("delete * from count where postdate < #" & aaa & "#")
sql0 = "select sess from count where sess='" & sessionID & "'"
set rscheck = connCount.Execute (sql0)
if rscheck.eof then
sql = "insert into count (sess,postdate) values('" & sessionID & "', '" & now() & "')"
connCount.Execute (sql)
end if
rscheck.close
set rscheck = nothing

sql2 = "select count(sess) from count"
set rs = connCount.Execute (sql2)
count = rs(0)
rs.close
set rs = nothing


sql3 = "select * from count"
set rspredel = connCount.Execute (sql3)
do until rspredel.eof
xxx=DateDiff("n", rspredel("postdate"), Now())
if xxx > timeout then
count = count-1
end if
rspredel.movenext
loop
rspredel.close
set rspredel = nothing

connCount.Close
set connCount = nothing

if count = 0 then
count = 1
end if
%>
这段代码能运行起来,但是把这代码嵌套在别的面出会很慢.提示
Active Server Pages, ASP 0113 (0x80004005)


[[it] 本帖最后由 kgdipbyve 于 2008-11-14 16:48 编辑 [/it]]
搜索更多相关主题的帖子: 统计 在线 
2008-11-14 16:34
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
[bo][un]kgdipbyve[/un] 在 2008-11-14 16:34 的发言:[/bo]
<%
sessionID = session.SessionID
timeout =1
aaa = dateadd("n", -timeout, now())
connCount.Execute ("delete * from count where postdate < #" & aaa & "#")
'这里的时间好像不能直接比较大小吧?
sql0 = "select sess from count where sess='" & sessionID & "'"
set rscheck = connCount.Execute (sql0)
if rscheck.eof then
   sql = "insert into count (sess,postdate) values('" & sessionID & "', '" & now() & "')"
   connCount.Execute (sql)
end if
rscheck.close
set rscheck = nothing

sql2 = "select count(sess) from count"
set rs = connCount.Execute (sql2)
count = rs(0)
rs.close
set rs = nothing


sql3 = "select * from count"
set rspredel = connCount.Execute (sql3)
do until rspredel.eof
   xxx=DateDiff("n", rspredel("postdate"), Now())
   if xxx > timeout then
      count = count-1
   end if
   rspredel.movenext
loop
rspredel.close
set rspredel = nothing

connCount.Close
set connCount = nothing

if count = 0 then
   count = 1
end if
%>
%>
这段代码 ...

另外把错误信息贴完整
2008-11-15 13:25
kgdipbyve
Rank: 2
等 级:论坛游民
帖 子:346
专家分:35
注 册:2008-5-4
收藏
得分:0 
找到错了。connCount这个错了。是CONN,
谢了斑竹!
现在还有个问题就是,我要在首页里显示别的页面下的在线人数的
这个应该怎么写?

[[it] 本帖最后由 kgdipbyve 于 2008-11-15 14:36 编辑 [/it]]
2008-11-15 14:30
快速回复:在线统计引用问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030404 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved