static.htm
<html>
<head>
<title>在静态页面中显示文章被阅读的次数-测试</title>
</head>
<body>
<script src="counter.asp?id=1"></script>
</body>
</html>
counter.asp
<%
dim conn,hits
set conn = server.CreateObject("ADODB.Connection")
Connstr="driver={SQL Server};server=(local); uid=sa; pwd=;database=test"
conn.Open Connstr
dim id
id = request.QueryString("id")
'给文章点击数加1
sqlStr="update static set Hits=Hits+1 where id=" & id
conn.Execute sqlStr
'读出文章点击数
hits=conn.execute("select hits from static where id=" & id)(0)
%>
document.write(<%=hits%>)