VB.NET BindingSource过滤两列转换无效 [英] VB.NET BindingSource Filter two column conversion not valid

查看:149
本文介绍了VB.NET BindingSource过滤两列转换无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要过滤我的Table2 ID号和年> = 2010。

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

这是我的代码过滤器:

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

当我启动应用程序并点击具有此代码的按钮时,我得到:

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


从字符串osobljeID ='1'到类型Long的转换无效。

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.

(例如[Me.Table2BindingSource.Filter = osobljeID ='&OsobljeIDTextBox.Text&'])
但是用And它给错误。

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

推荐答案

试试这个:

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

运算符AND应为过滤字符串的一部分。

The operator AND should be part of the filter string.

这篇关于VB.NET BindingSource过滤两列转换无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆