Reputation: 43
So I am having a probem with an SQL Update Statement.
I am running it when a user logs in the following code runs:
Dim UpdateSQL As String
UpdateSQL = "UPDATE tblUsers SET LoginDate = GETDATE()"
UpdateSQL = UpdateSQL & " WHERE ID = '" & Session("ID") & "'"
the problem I think is with the Session("ID")
part as when I explicitly call out what record to update that works just fine.
Upvotes: 0
Views: 187
Reputation: 11078
If your ID
is of type int
, you should omit '
:
UpdateSQL = UpdateSQL & " WHERE ID = " & Session("ID")
But be aware of SQL injection!
Additionally, maybe it's better not to use Session("ID")
. I guess you get the ID
while logging in the user. Store the value in a variable and use this variable in your query, not the session.
Upvotes: 1