Hi.
I want to search the database and find all the records in particular date range. I select dates from DateTimePicker. The appropriate field in the database is in short date format (Access database). I tried to perform this command: "SELECT * FROM MyTable WHERE DateField BETWEEN " + FromDateTimePicker.Value.ToShortDateString() + " AND " + ToDateTimePicker.Value.ToShortDateString(). It looks OK, but it finds no record. If I replace FromDateTimePicker.Value.ToShortDateString() with FromDateTimePicker.Value.Date it causes an exception. Can somebody write me what is the correct command in my case
Thanks.

Search the database with dates range
bpampuch
Alex Cunha
... BETWEEN #" +FromDateTimePicker.Value.ToLongDateString() + "# AND ...
The reason for the value and shortdate having different errors is that access sees a value such as 11/1/05 as a sum to calculate if it's not # seperated i.e. 11 divided by 1 divided by 5
Cathal