File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"select top * ..." with Access

 
yuki tanabe
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having trouble executing a PreparedStatement against a MS Access database. The query string, taken using Eclipse debugger during runtime is:

and I do

where pstmtFetchPage is the PreparedStatement.

When I execute the statement, I get the following error:


I really can't see what I'm doing wrong. Any help is very much appreciated.

cheers.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33697
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abe,
The database is complaining about the first question mark (the one after the keyword top.) In JDBC, you can't substitute just any part of the SQL in through a prepared statement. Basically, you can only put a value in (for the where clause.) You are going to need to build the first part of the statement dynamically.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic