如何使用Like过滤器

问题描述:

美好的一天



如何在DataView.RowFilter中使用特殊字符%和*

表达式,其中我已经有LIKE语句?





我使用DataView显示数据表中的记录。我允许

用户输入将以这种方式粘贴到RowFilter中的字符串



Good day

How can I use special characters % and * in DataView.RowFilter
expression in which I have already LIKE statement?


I am using a DataView to display records from datatable. I allow
users to enter the string which will be pasted into RowFilter in such way

MyDataView.RowFilter= myColumn LIKE '%"+MyTextBox.Text+"%'";





我必须在RowFilter语句中更改什么?



What must I change in the RowFilter Statement?

hi



dataView.RowFilter =Name LIKE'%ad%'//包含'ad的值'

如果你想要文本框的值,请尝试连接它



dataView.RowFilter =Name LIKE'%+ MyTextBox.Text +%';
hi

dataView.RowFilter = "Name LIKE '%ad%'" // values that contain 'ad'
if you want for the value of textbox,Please try to concatenate it

dataView.RowFilter = "Name LIKE '%"+MyTextBox.Text+%'";


我写了以下内容并且工作原理



I wrote the following and it works

ViewTermDetails.RowFilter = string.Concat("CONVERT(", myColumn,",System.String) LIKE '%", Textbox.Text, "%'"); 


to
Rate:

 very good
Solution 2







很棒的答案



thankssssssssss




Great Answer

thankssssssssss