I have a table in a SqlServer database which contains a couple of
DateTime fields, 'StartTime' and 'EndTime'. These fields are only used
to store time, not date. Since I don't specify any date information,
all the records have '1/1/1900' for their date.
Once I've loaded all the records into a DataView, I would like to be
able to filter the records by StartTime and EndTime. The time value I
want to filter on is stored in a TimeSpan variable. Apparently, you
can't compare DateTime values directly to TimeSpan values in a
RowFilter, so I wind up doing something like this:
DateTime date = new DateTime(time.Ticks);
DataView1.RowFilter = "(date > StartTime) AND (date < EndTime)";
Unfortunately, the .NET DateTime class starts at '1/1/0001'. So my
filter looks something like this:
"('1/1/0001 6:00AM' > '1/1/1900 6:00AM') AND ('1/1/0001 8:00PM' >
'1/1/1900 8:00PM)"
Which never returns any results, of course. What I want to do is JUST
compare two time values. Is there an easy way to do this?
TIA,
Gabe