Results 1 to 8 of 8

Thread: Syntax error in UPDATE statement.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    this should be simple but.......
    I have an ASP page that has a form w/ four text fields and on hidden field. it calls a page called update that has this code in it.
    ++++++++++++++++++++++
    dim FN,LN,EM,PN,SH
    FN = request.form("theDate") 'date of the event
    LN = request.form("location")'location of the event
    EM = request.form("hours") 'time of the event
    PN = request.form("title") 'main heading for event(title)
    SH = request.form("description")'text describing the event w/ some detail
    PW = request.form("ID")

    SQL = "Update main_event set date='" & FN & "', location='" & LN & "'"
    SQL = SQL & ", heading='" & EM & "', event='" & PN & "'" & _
    ", hours='" & SH & "', Password='" & PW & "' where ID =" & request.form("id")
    response.write SQl 'for testing
    set conn = server.createobject("ADODB.Connection")
    conn.open "pnj" 'DSN is pnj
    conn.execute SQl
    conn.close
    set conn = nothing

    ++++++++++++++++++++
    the error I get is:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.

    it says there is an error on line 16 (conn.execute sql)

    does anyone see anything wrong w/ this?
    the really strange thing is this code I took from another project and that project would work fine. I know I am just overlooking something simple.....

    thanks
    pnj

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    I think you need a userid and PW for the connection. That info is not stored in the DSN.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    I'm not sure I know what you meen.

    correct me if I am wrong(i usually am)
    the DSN points to the database. the database named pnj has a table called main_event that holds the fields named:
    date, location, heading, event, hours, Password and ID.

    the user already logged in using a password and username.

    I really don't get this stuff. One page works fine, I copied the sql string and changed the names to fit my database and now it won't work. but the syntax is the same as the original one that did work????

    thanks again
    pnj

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    The user logging in to your application has NOTHING to do with the userid and password for the database connection.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    I figured it out....
    my field names are 'saved' words.
    date and hours I changed and now it works.
    what do you meen by user id and password?

    the data base is a simple access DB.

    anyway it works no so no biggie.

    thanks
    pnj

  6. #6
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    I guess I just assumed that you would not be accessing an Access database using ODBC..

    You would need a userid & password to log into a DBMS such as SQL Server or Oracle.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537

    I should have been more descriptive...

    Just a simple simple web site.

    what should one use instead of ODBC when using Access?

    or should I just stick w/ ODBC becouse it works?

    thanks and sorry for the confusion.

    pnj

  8. #8
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Use the Jet 4.0 provider and ADO instead of ODBC. The OLEDB Jet provider is faster.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    monte96_@hotmail.com
    monte96@vbgarage.com


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

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