Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. syntax error in update statement

syntax error in update statement

Scheduled Pinned Locked Moved Visual Basic
helpdatabaseregexquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcm
    wrote on last edited by
    #1

    Dim updateSQL As String updateSQL = "Update Product Set " & _ " Description = '" & txtDesc.text & "', " & _ :confused:" Where Code = '" & txtCode.Text & "'" Set RS = Conn.Execute(updateSQL) This statement executes fine when i test it in access but here, it returns the above error. I have checked that all the fields are the same as that in the database and the textboxes match aswell. Neither txtcode or txtDesc are bound to any component. What could the problem be? if you need any more information, please let me know, any help would be greatly appreciated!!

    A 1 Reply Last reply
    0
    • M mcm

      Dim updateSQL As String updateSQL = "Update Product Set " & _ " Description = '" & txtDesc.text & "', " & _ :confused:" Where Code = '" & txtCode.Text & "'" Set RS = Conn.Execute(updateSQL) This statement executes fine when i test it in access but here, it returns the above error. I have checked that all the fields are the same as that in the database and the textboxes match aswell. Neither txtcode or txtDesc are bound to any component. What could the problem be? if you need any more information, please let me know, any help would be greatly appreciated!!

      A Offline
      A Offline
      Andy H
      wrote on last edited by
      #2

      You don't need the comma after the txtDesc.text. So the correct SQL command should work with: updateSQL = "UPDATE Product SET Description = '" & txtDesc.text & "'" & _ "WHERE Code = '" & txtCode.text & "'" Set RS = Conn.Execute(updateSQL) HTH:cool:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups