Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: update data

  1. #1
    New Coder
    Join Date
    May 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    update data

    Hello,

    I'm trying to update the customer's data in Access database from asp page.
    But it seems like the following statement has an syntax error.

    Here's the code.

    StrSQL = "UPDATE tbl_users_cdn SET BusinessName='" &BusinessName & "', UserName='" &UserName & "', UserPassword='" &UserPassword & "', " & _
    "Address='" &Address & "', Tel='" &Tel & "', Fax='" &Fax &"', Email='" &Email &"' WHERE ID= " & ID


    Here's the error message.

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.


    If somebody can tell me what's wrong in this code, I'd really appreciate it.

  • #2
    Regular Coder
    Join Date
    Jan 2005
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the ID is not being passed to the string:
    Code:
    WHERE ID= " & ID
    check where the value comes from and make sure it's being passed.

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    Print out StrSQL to see what it contains.

    In this case it looks like you either have an empty variable called ID, or your ID variable doesn't exist.

    Set "Option Explicit" at the top of the page and Dim all variables before use to prevent accidentally using a variable that doesn't exist.

  • #4
    New Coder
    Join Date
    May 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, ghell and mehere.

    By your emails, I noticed that I forgot to pass the ID from the previous page.
    It's now working fine.

    I really appreciate your 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
    •