Linq to sql搜索多个值. [英] Linq to sql search for multiple value.
本文介绍了Linq to sql搜索多个值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用linq to sql进行多值搜索,例如我有两个文本框
textbox1和textbox2,在这两个文本框中,我都可以输入多个值,然后在Button上单击我要基于在文本框中输入的值来搜索记录
How i can do multiple value search using linq to sql for example i have two textbox
textbox1 and textbox2 and in both the textbox i can enter multiple value and on the Button click i want to search record based on the values enter in the textbox
推荐答案
尝试一下
Try this
NorthwindDataContext db = new NorthwindDataContext();
var products = from p in db.Products where p.ProductName == txtBox1.Text ||
p.ProductName == txtBox2.Text select p;
这篇关于Linq to sql搜索多个值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文