Error using command.ExecuteNonQuery [resolved]
I recieve an error that says: "Syntax error in UPDATE statment" when executing the following code.
VB Code:
Dim strConn As String
Dim strSQL As String
Dim connection As New OleDb.OleDbConnection
strConn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\inetpub\wwwroot\Webapplication1\isi.mdb"
strSQL = "UPDATE keygenerator SET Section = 'H' WHERE RNDID = '" & ModGlobal.key & "'"
connection.ConnectionString = strConn
connection.Open()
Dim command As New OleDb.OleDbCommand
command.CommandText = strSQL
command.Connection = connection
Try
command.ExecuteNonQuery()
Catch ex As OleDb.OleDbException
ASPNET_MsgBox(ex.Message)
End Try
I have tested the actual SQL statement that is generated in this code using my database and it runs fine so the error shouldn't be an SQL issue. I usually program windows apps and this is my first ASP.NET web app. Is this method of executing a nonquery legal in a webapp? Any help is appreciated. thanks in advance.