Click to See Complete Forum and Search --> : SQL exception Too few parameters


Animalfarm
05-18-2009, 12:48 PM
hey

I am using Ready to program version 1.7 using Java 1.4.2. I made a connection with an Access database and I am executing my SQL-query in java.

ResultSet rs = stmt.executeQuery ("SELECT DateTakenOut, DateReturned, DATEDIFF(day, DateTakenOut, DateReturned) AS Days FROM Transactions WHERE LearnerID = 4111");

i got this error from java:
"java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1."

I got a tabel "Transactions" with "DateTakenOut" and "DateReturned" as fields and I want to get the difference between the 2 dates. It is the first time i am using the DATEDIFF() function so i don't know what I am doing wrong.

I did check to make sure that it is the DATEDIFF() function and its got something to do with the "day". But i cant figure it out.

please help...
animalfarm