Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Linq到实体通配符%_C#_Linq_Linq To Entities - Fatal编程技术网

C# Linq到实体通配符%

C# Linq到实体通配符%,c#,linq,linq-to-entities,C#,Linq,Linq To Entities,我正在尝试执行linq to entities语句,其中一个条件将包含通配符% 我有下面的代码,如果我从2个组合框中删除% var SLogged = from p in OEEEntity.Scrappages where p.Date >= StartDate where p.Date <= EndDate

我正在尝试执行linq to entities语句,其中一个条件将包含通配符%

我有下面的代码,如果我从2个组合框中删除%

var SLogged = from p in OEEEntity.Scrappages
                             where p.Date >= StartDate
                             where p.Date <= EndDate
                             where p.LogType.Contains(cmbType.Text)
                             where p.ScrapCode.Contains(cmbCode.Text)
                             orderby p.Date ascending
                             select p;
var sloged=从OEEEntity中的p开始。报废
其中p.Date>=起始日期
其中p.Date
.Contains(“aaa”)
相当于像“%aaa%”这样的

.StartsWith(“aaa”)
等同于类似于“aaa%”的

.EndsWith(“aaa”)
等同于类似于“%aaa”的

因此,您不必手动添加“%”

.Contains(“aaa”)
相当于像“%aaa%”这样的

.StartsWith(“aaa”)
等同于类似于“aaa%”的

.EndsWith(“aaa”)
等同于类似于“%aaa”的

因此,您不必手动添加“%”

.Contains(“aaa”)
相当于像“%aaa%”这样的

.StartsWith(“aaa”)
等同于类似于“aaa%”的

.EndsWith(“aaa”)
等同于类似于“%aaa”的

因此,您不必手动添加“%”

.Contains(“aaa”)
相当于像“%aaa%”这样的

.StartsWith(“aaa”)
等同于类似于“aaa%”的

.EndsWith(“aaa”)
等同于类似于“%aaa”的


因此,您不必手动添加“%”

处理通配符的最佳方法是使用

var sloged=(来自oeentity.scrasages中的p
其中p.Date>=起始日期
&&p.日期0
&&SqlFunctions.PatIndex(cmbCode.Text,p.ScrapCode)>0
按p.日期升序排序
选择p.ToList();

处理通配符的最佳方法是使用

var sloged=(来自oeentity.scrasages中的p
其中p.Date>=起始日期
&&p.日期0
&&SqlFunctions.PatIndex(cmbCode.Text,p.ScrapCode)>0
按p.日期升序排序
选择p.ToList();

处理通配符的最佳方法是使用

var sloged=(来自oeentity.scrasages中的p
其中p.Date>=起始日期
&&p.日期0
&&SqlFunctions.PatIndex(cmbCode.Text,p.ScrapCode)>0
按p.日期升序排序
选择p.ToList();

处理通配符的最佳方法是使用

var sloged=(来自oeentity.scrasages中的p
其中p.Date>=起始日期
&&p.日期0
&&SqlFunctions.PatIndex(cmbCode.Text,p.ScrapCode)>0
按p.日期升序排序
选择p.ToList();

这不是在回答问题,因为OP实际上没有在OP中问他的问题

var queryText = cmbType.Text;
var SLogged = from p in OEEEntity.Scrappages
                         where p.Date >= StartDate
                         where p.Date <= EndDate
                         where p.LogType.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         where p.ScrapCode.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         orderby p.Date ascending
                         select p;
var queryText=cmbType.Text;
var sloged=从p到oeentity.报废
其中p.Date>=起始日期

其中p.Date这不是回答问题,因为OP实际上没有在OP中问他的问题

var queryText = cmbType.Text;
var SLogged = from p in OEEEntity.Scrappages
                         where p.Date >= StartDate
                         where p.Date <= EndDate
                         where p.LogType.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         where p.ScrapCode.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         orderby p.Date ascending
                         select p;
var queryText=cmbType.Text;
var sloged=从p到oeentity.报废
其中p.Date>=起始日期

其中p.Date这不是回答问题,因为OP实际上没有在OP中问他的问题

var queryText = cmbType.Text;
var SLogged = from p in OEEEntity.Scrappages
                         where p.Date >= StartDate
                         where p.Date <= EndDate
                         where p.LogType.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         where p.ScrapCode.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         orderby p.Date ascending
                         select p;
var queryText=cmbType.Text;
var sloged=从p到oeentity.报废
其中p.Date>=起始日期

其中p.Date这不是回答问题,因为OP实际上没有在OP中问他的问题

var queryText = cmbType.Text;
var SLogged = from p in OEEEntity.Scrappages
                         where p.Date >= StartDate
                         where p.Date <= EndDate
                         where p.LogType.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         where p.ScrapCode.Contains(queryText) 
                                 || string.IsNullOrEmpty(queryText)
                         orderby p.Date ascending
                         select p;
var queryText=cmbType.Text;
var sloged=从p到oeentity.报废
其中p.Date>=起始日期

其中p.Date为什么不从字符串中删除
%
?既然您使用的
包含的
应该转换为使用
%
的SQL。为什么不从字符串中删除
%
?既然您使用的
包含的
应该转换为使用
%
的SQL。为什么不从字符串中删除
%
?既然您使用的
包含的
应该转换为使用
%
的SQL。为什么不从字符串中删除
%
?因为您使用的
包含的
应该转换为使用
%
的SQL。我要看的是用户是否从下拉列表中选择了%,而不是组合框中的项目筛选。几乎就像跳过where一样。您始终可以管理用户选择的内容和查询的内容。如果用户确实从下拉列表中选择了%,而不是按组合框中的项目进行筛选,则我会查看。几乎就像跳过where一样。您始终可以管理用户选择的内容和查询的内容。如果用户确实从下拉列表中选择了%,而不是按组合框中的项目进行筛选,则我会查看。几乎就像跳过where一样。您始终可以管理用户选择的内容和查询的内容。如果用户确实从下拉列表中选择了%,而不是按组合框中的项目进行筛选,则我会查看。几乎就像跳过where一样。您可以随时管理用户选择的内容和查询的内容。