Your date is all set for this one day, that's true, but it contains more than the
date
, it also contains the
time
! so comparing using both will result only in those entries which were inserted in the exact time point which probably returns nothing...
If you want all entries of the day, in your example it is 17.9.2013, make sure the
dateTimePicker1.Value
after converted, has the day's
very first time value of
00:00:00
and the
dateTimePicker2.Value
, after converted, has the
largest time value of
23:59:59.997
before you use the datetime in your query set the TIME,
Example:
Datetime dt1 = dateTimePicker1.Value.Date.AddHours(0).AddMinutes(0).AddSeconds(0);
Datetime dt2 = dateTimePicker2.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
Cheers,
Edo