• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PreparedStatement X DateTime Field

 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've a Table (PERSON) in the Access Database with the following fields
ID - Numeric
NAME - Text
BIRTHDAY - Date/Time
I need create a PreparedStatement for Select the PERSON by BIRTHDAY field, but the code don't work.
---
String Query = "SELECT * FROM person WHERE birthday = ?;
pstmt = con.prepareStatement(Query);
pstmt.setDate(1,adate);
pstmt.executeQuery();
A exception is thrown with message "Parameters Insufficient. Was expected 2."
I've tried utilize java.sql.Timestamp nut don't have functioned.
Thanks all
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most of the time this error message occurs because a column or table name was spelled wrong. The error message can be very misleading. If that doesn't work, then . Maybe try using a statement?
Jamie
 
Isaias C. Barroso
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks by response,
I will try others manner.
Best Regards,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic