LinQ:当select数据类型为大写或小写时,我的查询有问题 [英] LinQ : my query have a problem when select data is type uppercase or lowercase

查看:90
本文介绍了LinQ:当select数据类型为大写或小写时,我的查询有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我的问题是我有一个包含AREREN0330的字段当我输入数据时选择包含是GridView显示空数据。否则,如果我输入ARE,GridView的结果显示为AREREN0330



我使用的数据类型是nchar



你有什么解决方案吗?

Hi all !

my problem is I have a field with contain "AREREN0330" when I input data to select with contain is "are" GridView display Empty Data. Else if I input "ARE" GridView will result display is "AREREN0330"

I'm using data type is "nchar"

have you any solution for me ?

推荐答案

你应该使用像下一个LINQ例子中的Contains方法:

You should use Contains method like in the next LINQ example :
string name = "Ar";
query = from a in dataContext.Article
   where a.Name.Contains(name) 
   select a; 



这将匹配来自 Articles 表的所有记录,其中包含名称:AR,ar,Ar,aR。


This will match all records from Articles table that will contains the next strings value in their Name: "AR", "ar", "Ar", 'aR'.


这篇关于LinQ:当select数据类型为大写或小写时,我的查询有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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