English 中文(简体)
Linq 使用像样操作器的 Linq 查询不正确工作
原标题:Linq query for using LIKE operator doesn t work properly

我创建了一个SQL服务器存储程序, 我将它绑在下面的我阶级的财产上。

objSearchCustomerCDTO = DbContext.ExecuteStoreQuery<SearchCustomerCDTO>("exec GetSearchCustomerDetails").AsQueryable().ToList();

请注意,我仅仅使用存储程序来约束我的财产。

例如:我这一类的财产低于财产以下。

public string CustomerName {get;set;}

和存储程序返回

Select c.CustomerName as CustomerName from Customer

现在我只想要显示包含 bil - 的 CustmerName 包含 bil - 因为我使用过这个查询, 但我不知道为什么总是无效的。

var query = objSearchCustomerCDTO
            .Where(c => c.CustomerName.Contains("bil")).ToList();

请让我知道,我在上述询问中做错了什么。

谢谢 谢谢

最佳回答

试试这个

var query = objSearchCustomerCDTO
            .Where(c => c.CustomerName.ToLower().Contains("bil")).ToList();
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...