我有一个名为lotto的数据库整数列,并尝试使用3个文本框同时过滤datagrid,但无法使用“ LIKE” SQL查询来过滤整数值。如何替换“ LIKE”以使其正常工作?还是有更快的方法同时使用多个datagrid列?
If TB_regal_3.Text = String.Empty And TB_lotto_3.Text = String.Empty Then
Me.Mag_pretyBindingSource.Filter = "kod like '%" & TB_kod_3.Text & "%'"
ElseIf TB_lotto_3.Text = String.Empty Then
Me.Mag_pretyBindingSource.Filter = "kod like '%" & TB_kod_3.Text & "%' AND regal like '%" & TB_regal_3.Text & "%'"
ElseIf TB_regal_3.Text = String.Empty Then
Me.Mag_pretyBindingSource.Filter = "kod like '%" & TB_kod_3.Text & "%' AND lotto like '%" & TB_lotto_3.Text & "%'"
Else
Me.Mag_pretyBindingSource.Filter = "kod like '%" & TB_kod_3.Text & "%' AND regal like '%" & TB_regal_3.Text & "%' AND lotto like " & TB_regal_3.Text
System.Data.EvaluateException:'类似于moynawykonać运算符'类似于System.Int32 i System.String。'
答案 0 :(得分:0)
我已经找到答案了
(Convert(lotto, 'System.String') like '%" & TB_lotto_3.Text & "%')