ASP Access实现网站计数器(访问量)
程序员文章站
2022-05-18 11:33:09
<% set conn=server.createobject("adodb.connection") connstr="provider=microsoft.jet...
<%
set conn=server.createobject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("cou.mdb") //cou是数据库名
conn.open connstr
if session("visited")<>"yes" then
application.lock()
conn.execute("update counter set hits=hits+1 where kid=1") //counter是数据库里面用于存储数据的表名
application.unlock()
session("visited")="yes"
end if
set rs=conn.execute("select * from kuo where kid=1")
if rs.eof and rs.bof then
counters=0
else
counters=rs("hits")
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
set conn=server.createobject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("cou.mdb") //cou是数据库名
conn.open connstr
if session("visited")<>"yes" then
application.lock()
conn.execute("update counter set hits=hits+1 where kid=1") //counter是数据库里面用于存储数据的表名
application.unlock()
session("visited")="yes"
end if
set rs=conn.execute("select * from kuo where kid=1")
if rs.eof and rs.bof then
counters=0
else
counters=rs("hits")
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
上一篇: 28核U+1.5TB内存 史上性能最强Mac Pro散热揭秘
下一篇: 这种借口我听的太多了