ASP Access實現(xiàn)網(wǎng)站計數(shù)器(訪問量)
更新時間:2008年11月12日 00:30:30 作者:
學習asp的朋友需要了解下
<%
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.jet.oledb.4.0;data source="&server.mappath("cou.mdb") //cou是數(shù)據(jù)庫名
conn.open connstr
if session("visited")<>"yes" then
application.Lock()
conn.execute("update counter set hits=hits+1 where kid=1") //counter是數(shù)據(jù)庫里面用于存儲數(shù)據(jù)的表名
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是數(shù)據(jù)庫名
conn.open connstr
if session("visited")<>"yes" then
application.Lock()
conn.execute("update counter set hits=hits+1 where kid=1") //counter是數(shù)據(jù)庫里面用于存儲數(shù)據(jù)的表名
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
%>
您可能感興趣的文章:
- 詳解Java多線程編程中CountDownLatch阻塞線程的方法
- Java多線程編程之CountDownLatch同步工具使用實例
- java線程并發(fā)countdownlatch類使用示例
- Java數(shù)據(jù)結(jié)構(gòu)及算法實例:快速計算二進制數(shù)中1的個數(shù)(Fast Bit Counting)
- js計數(shù)器代碼
- Redis的使用模式之計數(shù)器模式實例
- PHP計數(shù)器的實現(xiàn)代碼
- php計數(shù)器的設計與實現(xiàn)
- MySQL中實現(xiàn)高性能高并發(fā)計數(shù)器方案(例如文章點擊數(shù))
- Java中CountDownLatch用法解析
相關文章
asp下輕松實現(xiàn)將上傳圖片到數(shù)據(jù)庫的代碼
asp下輕松實現(xiàn)將上傳圖片到數(shù)據(jù)庫的代碼...2007-11-11ASP基礎入門第十篇(ASP內(nèi)建對象Server)
這篇文章主要介紹了ASP內(nèi)建對象Server的相關資料,需要的朋友可以參考下2015-10-10