File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Formatting Date with Microsoft Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Formatting Date with Microsoft Access" Watch "Formatting Date with Microsoft Access" New topic

Formatting Date with Microsoft Access

Rik Sweeney
Ranch Hand

Joined: Sep 04, 2001
Posts: 36
I'm attempting to connect to a Microsoft Access database and get am pulling out some data to a ResultSet. I'm attempting to format the date using the format command
SELECT tblCases.fldCaseID, tblCases.fldCaseName, tblCases.fldCaseTypeID, Format(fldDateStart,"dd/mm/yyyy") AS Expr1, Format(fldDateEnd,"dd/mm/yyyy") AS Expr2, tblCases.fldUserID
FROM tblCases;
This is the query string and I've tested it in Access 97 and it is valid. However when I put it in my query string in my Java class I get "Too Few Parameters. Expected 1." reported back to me.
If I remove the Format command from the query then it works fine. Can anyone help?

Joined: Apr 22, 2002
Posts: 1
Might be the problem with "" quotes in the format. Chnage it to single quotes or make it
a proper java string by proper concatenation.
Hope this helps.
Don't get me started about those stupid light bulbs.
subject: Formatting Date with Microsoft Access
It's not a secret anymore!