Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database , To send a sql to database to get all columns for DATETIME

Status
Not open for further replies.

flyclassic22

Technical User
Oct 1, 2002
54
SG
Hello, i hope guys up here can get help in this

i'm currently using MsAccess to create a database table
call StudentRecords one of the fields is a Date/Time type call "DOB"
which i set the format to be dd/mm/yyyy <-date of birth.

However i've problem retrieving records using SQL
WHERE & BETWEEN statement below :

Select * From StudentRecords WHERE DOB BETWEEN '19/08/1955'
And '05/08/2003'


It keeps giving me problem this problem:


java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.


*I think it is telling me that the Type DATETIME in Msaccess database cannot except the string '19/08/1955'.
If so, how do i display the results where the Date of birth
has it's date falls within the two dates i want
?
Funny thing is i've no problem inserting a String &quot;12/12/1955&quot; to the database record of DOB even when the type is a DATETIME i still able to insert it.

I've tried using Text instead of DateTime in my DOB field and has no problem with my sql BETWEEN statement, however
the results shown is not what i wanted as it is a TEXT format, the result of using BETWEEN Statement is doing in the TEXT format way. Meaning the results that is shown eventually does not falls within the range of date i've set.

Thanks for looking.
Hoping for a helpful clue/hint/solutions to let me continue my project . Thanks alot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top