|
-
Jan 15th, 2004, 02:56 PM
#1
Thread Starter
Lively Member
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.
Last edited by ERage; Jan 16th, 2004 at 10:02 AM.
-
Jan 16th, 2004, 05:38 AM
#2
Frenzied Member
the syntax looks fine to me... what kind of dbtype is the key value? Is it possible it is a number field and you use ' ' around it?
perhaps someone else with sharper eyes than me can find any other problems?
kind regards
Henrik
-
Jan 16th, 2004, 08:56 AM
#3
Thread Starter
Lively Member
Unfortunately both fields used in the query are stored as text in the DB (for the purpose of keeping leading zeros on the RNDID number).
-
Jan 16th, 2004, 10:02 AM
#4
Thread Starter
Lively Member
I think I got it, I changed section to another term and it worked
fine. possibly a keyword? anyways, thanks for the help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|