我们如何使用Linq从数据库中选择不匹配的字符串 [英] How do we select unmatched strings from database using Linq

查看:67
本文介绍了我们如何使用Linq从数据库中选择不匹配的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要比较数据库中的字符串,还要选择不匹配的项目。

我的表中有以下数据



Hi,
I need to compare strings from database and also select unmatched items.
I have following data in my table

Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
Purchase Price,Note Rate and Program changed
purchase price updated
purchase price updated
purchase price updated
purchase price updated
purchase price updated
purchase price updated



从这一行开始,我需要输出




From this row,i need to get output as

Purchase Price,Note Rate and Program changed
purchase price updated





使用Linq h比较字符串并得到无法比拟的行..请帮助我



By using Linq how to compare strings and get unmatched rows..Pls help mee

推荐答案

您可以尝试如下。



这只是一个样本。根据您的情况使用它。



You can try is as below.

This is just a sample.Use it according to your scenario.

var list1 = products.DistinctBy(x=> x.Code);





DistinctBy(按属性查找不同的对象) [ ^ ]


这篇关于我们如何使用Linq从数据库中选择不匹配的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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