When I try to update a "visits" field in a "users" table, by using global.asa's Session_OnStart, I get the following error:
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
//global.asa, line 28
I am fairly certain that this Query statement is correct with how the db "users" table is designed. Here is my code:
Sub Session_OnStart
userID = Request.Cookies("userID"
if userID<>"" then
Set rsOldVisits = Server.CreateObject("ADODB.RecordSet"
Query = "SELECT visits FROM users WHERE userID=" & userID
rsOldVisits.Open CStr(Query), conn
if not rsOldVisits.EOF then
old_visits = rsOldVisits("visits"
else
old_visits = 0
end if
new_visits = old_visits + 1
Set rsNewVisit = Server.CreateObject("ADODB.RecordSet"
Query = "UPDATE users SET visits='" & new_visits & "' WHERE userID='" & userID & "'"
rsNewVisit.Open CStr(Query), conn
end if
End Sub
What am I doing wrong? Thanks!!
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
//global.asa, line 28
I am fairly certain that this Query statement is correct with how the db "users" table is designed. Here is my code:
Sub Session_OnStart
userID = Request.Cookies("userID"
if userID<>"" then
Set rsOldVisits = Server.CreateObject("ADODB.RecordSet"
Query = "SELECT visits FROM users WHERE userID=" & userID
rsOldVisits.Open CStr(Query), conn
if not rsOldVisits.EOF then
old_visits = rsOldVisits("visits"
else
old_visits = 0
end if
new_visits = old_visits + 1
Set rsNewVisit = Server.CreateObject("ADODB.RecordSet"
Query = "UPDATE users SET visits='" & new_visits & "' WHERE userID='" & userID & "'"
rsNewVisit.Open CStr(Query), conn
end if
End Sub
What am I doing wrong? Thanks!!