VB.NET BindingSource Filter two column conversion not valid

做~自己de王妃 提交于 2019-12-11 12:52:00

问题


I need to filter my Table2 with ID number and with year >=2010.

This is my code for filter:

Me.Table2BindingSource.Filter = "osobljeID ='" & OsobljeIDTextBox.Text & "'" And "Godina >=" & txtGodP.Text

When I start app and click on button with this code I got:

Conversion from string "osobljeID ='1'" to type 'Long' is not valid.

When I use only one column to filter all is working but I need two.

(e.g [Me.Table2BindingSource.Filter = "osobljeID ='" & OsobljeIDTextBox.Text & "'"]) but with "And" it give err.


回答1:


Try this:

Me.Table2BindingSource.Filter = "osobljeID = '" & OsobljeIDTextBox.Text & "' AND Godina >= " & txtGodP.Text

The operator AND should be part of the filter string.



来源:https://stackoverflow.com/questions/32356973/vb-net-bindingsource-filter-two-column-conversion-not-valid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!