计数器统计问题,菜鸟问题
xzjxu 2005-11-02 05:43:24 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
%>