DataView.RowFilter and DateTime column

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I'm trying to set the RowFilter = "MyDateTimeColumn in ('2005-02-21')" but
it returns 0 rows. I know the row is there. If change the RowFilter to
RowFilter = "MyDateTimeColumn not in (all the other dates but 2005-02-21) it
returns the rows.

Any suggestions?
 
more info. It turns out that when using not in all records are returned.

If I do MyDateTimeColumn > #2/28/2005# than all rows with a date equal or
greater is returned.

It seems RowFilter really doesn't handle Dates too well.

I also checked to make sure there is no time with the date in the table and
there isn't. I display the DataView in a DataGrid for testing.
 
Hi,

You need to wrap dates into # (and you did it already), but I believe you
need to pass them in a different format - it either mm/dd/yyyy format or
format defined in a regional settings of your PC.
 
I tracked down my problem. The issue was the time. The data grid didn't
display the time so I loaded the datetime column into a listbox and saw the
time was actually 2AM for all records. I was able to come up with a way of
tracking this time and added it to my RowFilter.
 
Back
Top