Year() function in BindingSource.Filter property
I have a DataGrid that is bound to a DataTable with a BindingSource. In my DataTable, there is a DateTime field that is used to record payment history for many years. I am unable to filter my list(DataGrid) using the BindingSource.Filter property which gives me only a result of paymen开发者_如何学运维t in year 2010.
paymentBindingSource.Filter = "Year(PaymentDate)='2010'";
Then i got an error. 'The expression contains undefined function call Year().' Anyone has any ideas?
The filter property must follow the syntax defined here as far as i can see there is no Year()
function, hence the error. I would suggest you add an extra column to your data source that contains the value of the year of the payment date and then filter on that column.
精彩评论