Mhtml
09-28-2002, 06:29 AM
Ok, I have a counter on my site that works fine but I made it by cutting and pasting from various other scripts with no real code created by me.
So now I tried to make one, completely out of my head. I can get it to count but the problem is it counts from 0 to 2 and then stops.
I've no idea why. Here is the code:
<%
Set OdysseyCountConn = Server.CreateObject("adodb.connection")
OdysseyCountConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("odysseycount.mdb")
GetCount = "SELECT COUNT(Count) as Ccount FROM Counter"
set rs = OdysseyCountConn.Execute(GetCount)
AddCount = "UPDATE Counter SET Count = "& rs("Ccount") + 1
OdysseyCountConn.Execute(AddCount)
OdysseyCountConn.close
Set OdysseyCountConn = nothing
set rs = nothing
%>
So now I tried to make one, completely out of my head. I can get it to count but the problem is it counts from 0 to 2 and then stops.
I've no idea why. Here is the code:
<%
Set OdysseyCountConn = Server.CreateObject("adodb.connection")
OdysseyCountConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("odysseycount.mdb")
GetCount = "SELECT COUNT(Count) as Ccount FROM Counter"
set rs = OdysseyCountConn.Execute(GetCount)
AddCount = "UPDATE Counter SET Count = "& rs("Ccount") + 1
OdysseyCountConn.Execute(AddCount)
OdysseyCountConn.close
Set OdysseyCountConn = nothing
set rs = nothing
%>