Using BindingSource Filters and Date Values
Posted on 2009-06-28
Hi, I'm using VB 2005, WinForms. I have a BindingSourse set to a DataGridView on one of my Forms. I've been able to filter within the DataGridView without a problem, except for DATE values.
I keep getting the following error message when I try to filter for the presence of a date within a column.
An unhandled exception of type 'System.Data.EvaluateException' occurred in System.Data.dll
Additional information: Cannot perform '=' operation on System.DateTime and System.String.
I've tried coding the filter in the following ways:
bs.Filter = "CanceledDate = ' ' "
bs.Filter = "CanceledDate = 'dbNull.Value'"
Neither seems to work.
I simply need to know if a Date value is present in the cell or if the cell is empty. If there is no Date present, then the item has not been canceled. If there is a Date value present in the cell, then the item was indeed canceled.
This is a syntax problem, but I can't seem to get it right.
Thanks for your help,