Results 1 to 5 of 5
  1. #1
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post Syntax Error in Query expression

    Hi guys,
    Am using MS Access database.
    To access data from the database, i use the following query
    Java Code:
    String query = "SELECT * FROM PathConfig WHERE AcademicYears = '"+acadYr+"'_StudentResults.xls";
    On executing the above query, i get a syntax error "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in query expression 'AcademicYears = '2009_2010'_StudentResults.xls'."

    Anyone with an idea on how i can solve this error??

    Your response will be highly appreciated.

    Cheerz!!:(
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    What is
    Java Code:
    'xxxxxx'_StudentResults.xls
    (with xxxxx being the value of acadYr) suppossed to be?

    Do you know SQL at all?

  3. #3
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Default

    Quote Originally Posted by masijade View Post
    What is
    Java Code:
    'xxxxxx'_StudentResults.xls
    (with xxxxx being the value of acadYr) suppossed to be?

    Do you know SQL at all?
    'xxxx' or whatever you want to call it, its string variable that is supposed to be combined with _StudentResults.xls to make up a complete string. For instance, 2009_2010_StudentResults.xls:confused:
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  4. #4
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Default

    Figured it out and i know sql!!!!
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    8

    Default

    Quote Originally Posted by Manfizy View Post
    Figured it out and i know sql!!!!
    Really? That quoted piece didn't really look like it. You should be looking at PreparedStatement, you know?

Similar Threads

  1. javadb syntax error
    By ron2794 in forum JDBC
    Replies: 9
    Last Post: 01-06-2011, 03:21 PM
  2. No more syntax error
    By ideyatech in forum Java Software
    Replies: 2
    Last Post: 04-22-2010, 04:20 AM
  3. stuck on same syntax error....
    By Moltisanti in forum New To Java
    Replies: 2
    Last Post: 09-01-2009, 04:26 AM
  4. how to solve syntax error
    By pro85 in forum Java Applets
    Replies: 5
    Last Post: 04-06-2009, 11:20 AM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 03:26 PM

Posting Permissions

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