开发者

Year() function in BindingSource.Filter property

开发者 https://www.devze.com 2023-03-31 18:42 出处:网络
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(Dat

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消