If Session("counter")=Empty Then
Set conn = Server.CreateObject("ADODB.Connection")
DBPath =Server.MapPath("../db/free.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &DBPath
SET rs =Server.CreateObject("ADODB.Recordset")
rs.open "counter",conn,3,2
If rs.BOF=True Then
rs.AddNew
rs("counter")=0
rs.Update
End If
rs("counter")=rs("counter")+1
rs.Update
Else
Set conn=Server.CreateObject("ADODB.Connection")
DBPath=Server.MapPath("../db/free.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &DBPath
SET rs=Server.CreateObject("ADODB.Recordset")
rs.open "counter",conn,3,2
If rs.BOF=True Then
rs.AddNew
rs("counter")=0
rs.Update
End If
End If
Session("counter")=rs("counter")
% >
< html >
< head >
< title >計數器< /title >
< /head >
< body bgcolor="#0000FF" vlink="#0000FF" >
< font color="#FFFF99" >< %=rs("counter")% >< /font >
< /body >
< /htm l>
沒有留言:
張貼留言