This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes an access database problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "an access database problem" Watch "an access database problem" New topic
Author

an access database problem

Pierre Guersley
Greenhorn

Joined: Oct 31, 2001
Posts: 6
hi guys,
it's my first time here, and i'd like to know if someone has met that error??
count field incorrect with an ms-access db using preparedStatement. here it is:
String get="SELECT * FROM FAQS WHERE ID=?";
String put="INSERT INTO FAQS VALUES (?, ?, ?, ?)";
//String put="INSERT INTO FAQS VALUES (NEXTVAL('faqid_seq'), ?, ?, ?)";
String rem="DELETE FROM FAQS WHERE ID=?";
String upd="UPDATE FAQS SET QUESTION=?, ANSWER=?, MODIFIED=? WHERE ID=?";
String all="SELECT * FROM FAQS ORDER BY ID";
it doesn't take the insert instruction any help would be very appreciated
thanks in advance
Pierre
Praveen Balaji
Ranch Hand

Joined: Jun 17, 2001
Posts: 60
Can you clarify that one. How exactly are you trying to create the statements using the prepared statement? can you include the piece of code?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

keywords = Access, insert, sounds like this problem , or might be a place to start
Dave.
Pierre Guersley
Greenhorn

Joined: Oct 31, 2001
Posts: 6
Thanks guys, but i have solved the problem!!! by the way, the same question has been asked in April without no answer. the solution is: the number of quotation marks you have in your insert or update preparedStatement have to match the number of fields in the executeUpdate instruction. The problem is , we don't always think of that.
Once again thanks, your forum is a good idea, if i can help, i'll be happy to do so in the future!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: an access database problem