使用linq to sql的 "Where In"。[英] "Where In" with linq to sql

本文是小编为大家收集整理的关于使用linq to sql的 "Where In"。的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我试图在文本框中输入关键字后向用户提供数据库表中的项目列表.我目前遇到的问题是用户可以输入多个关键字,我希望能够只执行一次到数据库的往返并返回匹配多个关键字的结果(OR 操作).有没有一种方法可以执行这样的任务,而不必为每个关键字都访问数据库?

推荐答案

我找到了一个帖子 为我试图实现的目标提供了一个很好的解决方案.感谢您的帮助!

本文地址:https://www.itbaoku.cn/post/1557151.html

问题描述

I am trying to provide the user with a list of items in a database table upon entering keywords in a textbox. The problem i currently have is that the user can enter several keyword and i would like to be able to perform only one roundtrip to the database and get back results matchings several keywords (an OR operation). Is there a way to perform such a task without having to hit the database for every single keyword?

推荐答案

I found a post that offer a pretty good solution to what I was trying to achieve. Thank you for your help!