Having a brainfart here. Any idea why I can't get the query to match dates? If I remove the date from the end of the query it works fine. I just can't seem to find why it won't match the date with the date field in the database. No matter what it always writes a new record. Here's the code.
dim rsh*t
dim conHit
dim strHitIP
dim strExtradata
dim dHitdate
dim strHitdbpath
dim strHitsql
strHitIP = trim(Request.ServerVariables("REMOTE_ADDR"))
strExtradata = trim(Request.ServerVariables("ALL_HTTP"))
dHitdate = cdate(month(now()) & "/" & day(now()) & "/" & year(now()))
set conHit = server.CreateObject("ADODB.Connection")
set rsh*t = server.CreateObject("ADODB.Recordset")
with rsh*t
.CursorType = 2
.LockType = 3
end with
strHitdbpath = server.MapPath("/forum/admin/database/hitcount.mdb")
conHit.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strHitdbpath 'This one is for Access 2000/2002
conHit.Open
strHitsql = "SELECT tblHit.* FROM tblHit WHERE tblHit.Hit_IP='"
strHitsql = strHitsql & strHitIP & "' AND tblHit.Hit_date=" & dHitdate & ";"
rsh*t.Open strHitsql, conHit
if rsh*t.EOF and rsh*t.BOF then
with rsh*t
.AddNew
.Fields("Hit_IP") = strHitIP
.Fields("Hit_data") = strExtradata
.Fields("Hit_date") = dHitdate
.Update
end with
end if
rsh*t.Close
set rsh*t = nothing
conHit.Close
set conHit = nothing
Any and all help appreciated.
Also, I get no errors from this code at all.
Edited by Ignorance