Results 1 to 4 of 4

Thread: Error using command.ExecuteNonQuery [resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Location
    Savannah, GA
    Posts
    100

    Error using command.ExecuteNonQuery [resolved]

    I recieve an error that says: "Syntax error in UPDATE statment" when executing the following code.

    VB Code:
    1. Dim strConn As String
    2.         Dim strSQL As String
    3.         Dim connection As New OleDb.OleDbConnection
    4.  
    5.         strConn = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\inetpub\wwwroot\Webapplication1\isi.mdb"
    6.  
    7.         strSQL = "UPDATE keygenerator SET Section = 'H'  WHERE RNDID = '" & ModGlobal.key & "'"
    8.  
    9.         connection.ConnectionString = strConn
    10.         connection.Open()
    11.  
    12.         Dim command As New OleDb.OleDbCommand
    13.         command.CommandText = strSQL
    14.  
    15.         command.Connection = connection
    16.  
    17.         Try
    18.  
    19.             command.ExecuteNonQuery()
    20.         Catch ex As OleDb.OleDbException
    21.             ASPNET_MsgBox(ex.Message)
    22.         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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width