如何使用Like过滤器 [英] How to use Row Filter with Like

查看:82
本文介绍了如何使用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


这篇关于如何使用Like过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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