古代小说的宫殿的名字:asp统计点击数,服务器重启后会清零。能不能保存以前的统计数?
来源:百度文库 编辑:高校问答 时间:2024/04/28 06:57:38
你可以参考我的计数器:
<%
Dim Counter
Dim CounterFile
Sub Counter_Add()
On Error Resume Next
Counter = 0
Set CounterFile = Server.CreateObject("Scripting.FilesyStemObject")
Application.Lock
CounterFile.Open("Counter.txt")
Counter = CLng(CounterFile.ReadLine)
Counter = Counter + 1
CounterFile.Create "Counter.txt",True
CounterFile.WriteLine(Counter)
CounterFile.Close
Application.Unlock
Set CounterFile = nothing
End Sub
Sub Counter_Read()
On Error Resume Next
Counter = 0
Set CounterFile = Server.CreateObject("Scripting.FilesyStemObject")
CounterFile.Open("Counter.txt")
Counter = CLng(CounterFile.ReadLine)
Set CounterFile = nothing
End Sub
%>
在计数器累加的地方使用Call Counter_Add(),在读取计数器的地方使用Call Counter_Read(),然后用Response.Write(Counter) 输出。
是数据丢失了吧.呵呵.没保存在数据库或文本上
你用的是application 对象保存的值吧.
应该用数据库保存呀,简单点的可以直接用一个文本文件来保存也行
估计就是没存..直接用的application对象...