计数器统计问题,菜鸟问题
asp代码如下,请看一下注释掉的那一部分有什么错误吗?为什么days1表总是坏掉???
<%
mypath="http://cx.100asp.com/count/"
id=Request.QueryString("id")
if trim(id)<>EMPTY then
set conn=server.createobject("adodb.connection")
'conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " &
Server.MapPath("count.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &
Server.MapPath("count.mdb")
set rs=server.createobject("adodb.recordset")
Application.Lock '将对象锁定
SQLcmd = "select * from count where id='" & trim(id) & "'"
set rs=conn.Execute(SQLcmd)
if not rs.EOF then
dir=trim(rs("dir"))
k=rs("len")
count=rs("count")
a=session("a")
if ucase(typename(a))="EMPTY" then
redim a(0)
a(0)=id
session("a")=a
count=count+1
SQLcmd1 = "update count set count=" & cstr(count) & " where id='" &
trim(id) & "'"
conn.Execute SQLcmd1
SQLcmd1="insert into times(id,[time]) values('" & id & "','" & now & "')"
conn.Execute SQLcmd1
' tim=now
' SQLcmd = "select * from days1 where id='" & trim(id) & "' and hourS='" &
cstr(hour(tim)) & "'"
' set rs=conn.Execute(SQLcmd)
' if not rs.EOF then
' count=rs("count")
' count=count+1
' SQLcmd1 = "update days1 set count='" & cstr(count) & "' where id='" &
trim(id) & "' and hours='" & cstr(hour(tim)) & "'"
' conn.Execute SQLcmd1
' else
' SQLcmd1="insert into days1(id,hours,count) values('" & id & "','" &
cstr(hour(tim)) & "','1')"
' conn.Execute SQLcmd1
' end if
else
for i=0 to ubound(a)
if ucase(trim(id))=ucase(trim(a(i))) then exit for
next
if i>ubound(a) then
redim preserve a(ubound(a)+1)
a(ubound(a))=id
session("a")=a
count=count+1
SQLcmd1 = "update count set count=" & cstr(count) & " where id='" &
trim(id) & "'"
conn.Execute SQLcmd1
SQLcmd1="insert into times(id,[time]) values('" & id & "','" & now &
"')"
conn.Execute SQLcmd1
' tim=now
' SQLcmd = "select * from days1 where id='" & trim(id) & "' and hours='"
& cstr(hour(tim)) & "'"
' set rs=conn.Execute(SQLcmd)
' if not rs.EOF then
' count=rs("count")
' count=count+1
' SQLcmd1 = "update days1 set count='" & cstr(count) & "' where id='" &
trim(id) & "' and hours='" & cstr(hour(tim)) & "'"
' conn.Execute SQLcmd1
' else
' SQLcmd1="insert into days1(id,hours,count) values('" & id & "','" &
cstr(hour(tim)) & "','1')"
' conn.Execute SQLcmd1
' end if
end if
end if
conn.close
x = right(string(k,"0") & CStr(count),k)
%>
document.write("<% For i = 1 To Len(x)%><img border='0'
src='<%=mypath%><%=dir%>/<%=mid(x,i,1)%>.bmp'><%Next%>")
<% end if
Application.UnLock '将对象解除锁定
end if
%>
<%
mypath="http://cx.100asp.com/count/"
id=Request.QueryString("id")
if trim(id)<>EMPTY then
set conn=server.createobject("adodb.connection")
'conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " &
Server.MapPath("count.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &
Server.MapPath("count.mdb")
set rs=server.createobject("adodb.recordset")
Application.Lock '将对象锁定
SQLcmd = "select * from count where id='" & trim(id) & "'"
set rs=conn.Execute(SQLcmd)
if not rs.EOF then
dir=trim(rs("dir"))
k=rs("len")
count=rs("count")
a=session("a")
if ucase(typename(a))="EMPTY" then
redim a(0)
a(0)=id
session("a")=a
count=count+1
SQLcmd1 = "update count set count=" & cstr(count) & " where id='" &
trim(id) & "'"
conn.Execute SQLcmd1
SQLcmd1="insert into times(id,[time]) values('" & id & "','" & now & "')"
conn.Execute SQLcmd1
' tim=now
' SQLcmd = "select * from days1 where id='" & trim(id) & "' and hourS='" &
cstr(hour(tim)) & "'"
' set rs=conn.Execute(SQLcmd)
' if not rs.EOF then
' count=rs("count")
' count=count+1
' SQLcmd1 = "update days1 set count='" & cstr(count) & "' where id='" &
trim(id) & "' and hours='" & cstr(hour(tim)) & "'"
' conn.Execute SQLcmd1
' else
' SQLcmd1="insert into days1(id,hours,count) values('" & id & "','" &
cstr(hour(tim)) & "','1')"
' conn.Execute SQLcmd1
' end if
else
for i=0 to ubound(a)
if ucase(trim(id))=ucase(trim(a(i))) then exit for
next
if i>ubound(a) then
redim preserve a(ubound(a)+1)
a(ubound(a))=id
session("a")=a
count=count+1
SQLcmd1 = "update count set count=" & cstr(count) & " where id='" &
trim(id) & "'"
conn.Execute SQLcmd1
SQLcmd1="insert into times(id,[time]) values('" & id & "','" & now &
"')"
conn.Execute SQLcmd1
' tim=now
' SQLcmd = "select * from days1 where id='" & trim(id) & "' and hours='"
& cstr(hour(tim)) & "'"
' set rs=conn.Execute(SQLcmd)
' if not rs.EOF then
' count=rs("count")
' count=count+1
' SQLcmd1 = "update days1 set count='" & cstr(count) & "' where id='" &
trim(id) & "' and hours='" & cstr(hour(tim)) & "'"
' conn.Execute SQLcmd1
' else
' SQLcmd1="insert into days1(id,hours,count) values('" & id & "','" &
cstr(hour(tim)) & "','1')"
' conn.Execute SQLcmd1
' end if
end if
end if
conn.close
x = right(string(k,"0") & CStr(count),k)
%>
document.write("<% For i = 1 To Len(x)%><img border='0'
src='<%=mypath%><%=dir%>/<%=mid(x,i,1)%>.bmp'><%Next%>")
<% end if
Application.UnLock '将对象解除锁定
end if
%>
...全文
相关推荐
LTEKPI指标详解菜鸟零基础提升篇.pdf
LTEKPI指标详解菜鸟零基础提升篇.pdf
ASP.NET菜鸟之路之Application小例子
背景 我是一个ASP.NET菜鸟,暂时开始学习ASP.NET,在此记录下我个人敲的代码,没有多少参考价值,请看到的盆友们为我点个赞支持我一下,多谢了。 Session介绍 Application对象用来保存对所有用户共享的信息,比如网站登录人数。 在修改Application对象的时候,需要lock unlock,防止同时操作导致出现问题。 Application对象成员的生命周期止于关闭IIS或使用Clear方法清除。 Application传值 介绍一下Application记录进入网站的人数 新建一个全局变量文件,即Globle.asax,
LTE-KPI指标详解菜鸟零基础提升篇.doc编程资料
LTE-KPI指标详解菜鸟零基础提升篇.doc
LabVIEW数据采集DAQ实例源代码,菜鸟飞跃的台阶!
LabVIEW 数据采集 DAQ 实例 源代码
c++经典小程序 给菜鸟的!!1
很好的C++经典小程序,给初学C++的!


