lorena
Well-known member
I have an asp.net form that adds a record to a table and then increments a counter variable in another table before closing the connection. The add record part works fine but I am getting "Syntax error in UPDATE statement" when I try to update the incremented field in the counter table. (I started trying to do the operation as an INSERTbut that didnt work either)
Here is my code:
strSQL = "Update NumberGen set Counter = ~ where ID like SK"
strSQL = Replace(strSQL, "~", intCounter)
objCommand = New OleDb.OleDbCommand(strSQL, objConn)
objCommand.ExecuteNonQuery()
objConn.Close()
I have tried substituting an actual number in place of intCounter (didnt work) and also tried running it against the access database with an actual number in place of the variable (worked fine).
Any help would be appreciated. Thanks
Here is my code:
strSQL = "Update NumberGen set Counter = ~ where ID like SK"
strSQL = Replace(strSQL, "~", intCounter)
objCommand = New OleDb.OleDbCommand(strSQL, objConn)
objCommand.ExecuteNonQuery()
objConn.Close()
I have tried substituting an actual number in place of intCounter (didnt work) and also tried running it against the access database with an actual number in place of the variable (worked fine).
Any help would be appreciated. Thanks