VB sqlUpdate Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shadowsoulja
    New Member
    • Nov 2006
    • 9

    #1

    VB sqlUpdate Problem

    Ive been creating code to run a password change option within my program.

    Im having a bit of a problem, because what ive coded is coming up with a sytax error, and no matter what i do, it doesnt work.

    Ive got the program opening a database table called Admin, setting the password for the user Admin.

    this is what ive got.

    MsgBox "Username and password successfully entered.", vbOKOnly + vbInformation, "successful l"

    sqlUpdate = "UPDATE Admin " & _
    "SET Password = " & Text3 & " " & _
    "WHERE UserName = Admin"


    MsgBox sqlUpdate

    cnIVA.Execute sqlUpdate

    when i run it it says there is a syntax error.... but i dont see where...

    any help would be much apprieciated.
  • pureenhanoi
    New Member
    • Mar 2007
    • 175

    #2
    Originally posted by shadowsoulja
    Ive been creating code to run a password change option within my program.

    Im having a bit of a problem, because what ive coded is coming up with a sytax error, and no matter what i do, it doesnt work.

    Ive got the program opening a database table called Admin, setting the password for the user Admin.

    this is what ive got.

    MsgBox "Username and password successfully entered.", vbOKOnly + vbInformation, "successful l"

    sqlUpdate = "UPDATE Admin " & _
    "SET Password = " & Text3 & " " & _
    "WHERE UserName = Admin"


    MsgBox sqlUpdate

    cnIVA.Execute sqlUpdate

    when i run it it says there is a syntax error.... but i dont see where...

    any help would be much apprieciated.
    try this SQL statement
    Code:
    sqlUpdate = "UPDATE Admin " & _
                    "SET Password = '" & Text3 & "' " & _
                    "WHERE UserName = 'Admin'"
    Remember, Password and UserName are text-field, so quote its values by ' '.

    Comment

    Working...