Results 1 to 6 of 6

Thread: SQL and JAVA with Acces DataBase

  1. #1
    Join Date
    Aug 2005
    Posts
    5

    SQL and JAVA with Acces DataBase

    I have this String that I am trying to insert information into a database. It Keeps giving me a-- '[Microsoft][ODBC Microsoft Access Drive] Syntax error in INSERT INTO statement.'

    here is the code:

    String stmtSource = "INSERT into tblsyst" + "(Box, Height1, Level1, Main)" + "values ('" + one + "', '" +
    two + "', '" +
    three + "', '" +
    four + "')";

    what is causing this error?

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    This forum is for the ASP-db product. You can use this DLL to access all the datasources, VB, C# or J#. In you case, try to cut and paste your SQL into Access query and check for validity.

    Frank

  3. #3
    Join Date
    Aug 2005
    Posts
    5

    Tried something

    Hey Frank, I tried what ya told me too and it says the + sign after tblsyst" is causing something. I have another INSERT statement and its works great. I have it set up all the same way. Any Ideas.??

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    post the exact SQL statement that you type in tehAccess query that fails and the one that works. The "+" is the code and the SQL statement should be a string. Post exactly what you type in the Access query.

    Fk

  5. #5
    Join Date
    Aug 2005
    Posts
    5
    I still can't figure it out. On the good sql statement it errored out at the ' + '. ANy more Ideas?

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    you have to post the SQL queries, otherwise, nobody would know what you are talking about. Do not post the one in your code, post the one you use in the Access query. That i sthe one that counts. You can then figuer how to produce that with code. Also, use the Northwind example and not your own DB. That way, those who wants to help you can test that as well as yourself.

    Frank

Posting Permissions

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