如何使用文本框中的sql通配符模式过滤数据表 [英] How to filter datatable with sql wildcards patterns from textbox

查看:66
本文介绍了如何使用文本框中的sql通配符模式过滤数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





朋友我需要使用带有wilcards的查询字符串来过滤数据表记录,但我无法使用文本框过滤数据表。 />


我的查询是:

Hi,

Friends I need to filter the data table records using the query string with wilcards, but I cannot filter the data table with text box.

My query is:

string blockfill = "WardBlock like " + TextWardBlock.Text + "%";

那么有人可以帮助我吗?

上面的wilcard查询有什么问题?

So can anyone help me?
What is wrong in above wilcard query?

推荐答案





这取决于你,你想如何过滤查询。看看你的查询看起来很好。但请尝试以下结果。



Hi,

It depends upon you, how you want to filter query. Looking at your query it looks fine. but try following result.

string blockfill = "WardBlock like " + TextWardBlock.Text.Trim() + "%";
   Or
string blockfill = "WardBlock like %" + TextWardBlock.Text.Trim() + "%";


这篇关于如何使用文本框中的sql通配符模式过滤数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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