ASP Access实现网站计数器(访问量)
编程学习 2021-07-05 10:58www.dzhlxh.cn编程入门
学习asp的朋友需要了解下
<%
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
%>
上一篇:ASP新闻分页,将一篇过长的文章分页,生成静态
下一篇:ASP正则表达式技巧