Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2013
    Posts
    2

    Unanswered: ORA-00936: missing expression for Update Statement

    Hi,
    I've done a fair bit of searching but I can't seem to find any solution.
    Basically in my table, I want to change the status of a car from "Availble" to "De-Registered". The user searches a registration number, when a registration number is found it loads the model, manufacturer as well as the car's status ("Availble") I want to make the car's status "De-registered")
    This is my code but I keep running into the missing expression error.
    Thanks.
    Code:
     conn.Open()
    
    
    strSQL = "UPDATE Vehicles SET Status = '" + txtStatus.Text + "' +  WHERE Registration = " + txtCarRegistrationResults.Text
    cmd.CommandText = strSQL.ToString
    
            
    cmd.CommandType = CommandType.Text
            cmd.ExecuteNonQuery()
    
            'Close the database
            conn.Close()

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if its a text/string variable I'd expect them to be quoted

    strSQL = "UPDATE Vehicles SET Status = '" & txtStatus.Text & "' WHERE Registration = '" & txtCarRegistrationResults.Text & "'"

    the string concatenation character in VB/VBS/VBA is & although the compiler may be able to interpret that correctly it can cause problems if you have a numeric varaible


    usually with SQL problems its best to look at the actual SQL ie the value of strSQL rather than the VBA code that creates the SQL
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2013
    Posts
    2
    Thanks for the swift reply, I've changed that and now I am getting an error saying quoted string not properly terminated.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    OK so can we see the actual SQL (the value of strSQL)
    and or the VBA code that generates the SQL
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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