SteveH
03-14-2008, 10:49 AM
Hello
I have the following script which shows a simple hit to a site:
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Readfile = Server.MapPath ("count.txt")
Set File = FSO.OpenTextFile (Readfile, 1,true)
On Error Resume Next
Read = File.Readall
Count = Read
Count = Count + 1 'increments
File.Close
Writefile = Readfile
Set File = FSO.OpenTextFile (Writefile, 2)
File.Write("" & Count & "")
File.Close
Response.write("counter=" & Count & "")
Set FSO = Nothing
%>
If possible, I would like to store these hits to a database using something like the following, but I am unsure where to place it:
<%
Dim sql,conn
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\business\form.mdb;"
sql="INSERT INTO tblHitCount (HitNbr)"
conn.Execute sql
conn.close
%>
And advice would be appreciated.
Thanks
Steve
I have the following script which shows a simple hit to a site:
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Readfile = Server.MapPath ("count.txt")
Set File = FSO.OpenTextFile (Readfile, 1,true)
On Error Resume Next
Read = File.Readall
Count = Read
Count = Count + 1 'increments
File.Close
Writefile = Readfile
Set File = FSO.OpenTextFile (Writefile, 2)
File.Write("" & Count & "")
File.Close
Response.write("counter=" & Count & "")
Set FSO = Nothing
%>
If possible, I would like to store these hits to a database using something like the following, but I am unsure where to place it:
<%
Dim sql,conn
set conn=Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};DBQ=D:\business\form.mdb;"
sql="INSERT INTO tblHitCount (HitNbr)"
conn.Execute sql
conn.close
%>
And advice would be appreciated.
Thanks
Steve