http://blog.csdn.net/xht555/article/details/38685845

https://www.cnblogs.com/wuchao/archive/2012/12/25/2832744.html

IEnumerable<DataGridViewRow> enumerableList = this.dataGridView1.Rows.Cast<DataGridViewRow>();
                        List<DataGridViewRow> list = (from item in enumerableList
                                                      where item.Cells["projectCode"].Value.ToString() == txt_cmd.Text.Trim()
                                                      select item).ToList();

//数组转成字符串

IEnumerable<DataGridViewRow> DataGridList = this.rcomdgv2.Rows.Cast<DataGridViewRow>();
 String shopArrayLinq = String.Join(",", (from item in DataGridList where item.Cells["CheckShop"].Value.ObjToInt() == 1 select item.Cells["ShopID"].Value).Distinct());

//对应的数据赋值

IEnumerable<DataGridViewRow> DataGridList = this.rcomdgv2.Rows.Cast<DataGridViewRow>();
                        (from item in DataGridList where shopNameArry.Contains<string>(item.Cells["ShopID"].Value.ObjToString()) select item)
                        .ToList()
                        .ForEach(item => item.Cells["CheckShop"].Value = 1);

//求表格和

var TotalActualWeight = from p in enumerableList group p by p.Cells["out_barcode"].Value into g select new { TotalActual = g.Sum(p => p.Cells["weight"].Value.ObjToDecimal()) };
 ActualWeight.Value = TotalActualWeight.First().TotalActual;

C# 用Linq查询DataGridView行中的数据是否包含(各种操作)的更多相关文章

  1. DQL:data query language用来查询数据库表中的数据

    对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 如果没有查询条件,则每次查询所有的行.实际应用中,一般要指定查询的条件.对记录进行过滤. 查询 ...

  2. SQLserver将查询的字段中的数据 拼接成字符串用逗号隔开

    ,,'') 将查询的字段中的数据 拼接成字符串用逗号隔开

  3. 在 SQL Server 中查询EXCEL 表中的数据遇到的各种问题

    SELECT * FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0','Data Source="D:\KK.xls";User ID=A ...

  4. MVC设计模式((javaWEB)在数据库连接池下,实现对数据库中的数据增删改查操作)

    设计功能的实现: ----没有业务层,直接由Servlet调用DAO,所以也没有事务操作,所以从DAO中直接获取connection对象 ----采用MVC设计模式 ----采用到的技术 .MVC设计 ...

  5. 在dataGridView空间中添加数据

    //查询信息sql语句 string sql = "select studentName,addres from student"; SqlDataAdapter adapter ...

  6. 解决Spring中使用Example无法查询到Mongodb中的数据问题

    1 问题描述 在Spring Boot中使用Mongodb中的Example查询数据时查询不到,示例代码如下: ExampleMatcher matcher = ExampleMatcher.matc ...

  7. 查询制定行数的数据(2)对了,mysql不能用top关键字

    采用嵌套查询的方式,倒序之后前10条 倒序之后前9条 采用嵌套查询的方式,倒序之后前10条 排正序之后从第一条开始弄十条数据 排正序之后从第一条开始弄九条数据 排正序之后从第十条开始弄十条数据 排正序 ...

  8. Linq查询出结果集中重复数据

    private List<FMDS_FarmPlotNewInfo> GetSame(List<FMDS_FarmPlotNewInfo> lst) { List<FMD ...

  9. linq查询集合并分页展示数据

    private void Bind() { if (Request.QueryString["QuestionNo"] != null) { string QuestionNo = ...

随机推荐

  1. 如何bitbucket上删除项目

    老外网页操作习惯不同,删除项目的按钮,我花了半天,突然瞟到delete,如下图(真他妈的隐蔽,记住这2017/3/7):

  2. servlet输出请求头

    1.参考 Enumeration headerNames = req.getHeaderNames(); while(headerNames.hasMoreElements()) { String h ...

  3. 分布式网格缓存Coherence简介

    Coherence企业级缓存(一) 特点 摘要:Oracle Coherence是一个企业级的分布式集群缓存框架.具有自管理,自恢复,高可用性,高扩展性等优良特点,在电信BOSS等项目中有很大的应用价 ...

  4. SQL Server表分区-水平分区

    SQL Server表分区,sql server水平分区 转自:http://www.cnblogs.com/knowledgesea/p/3696912.html  根据时间的,直接上T-SQL代码 ...

  5. iOS开发-url包括中文报错解决的方法

    常常, 我们用通过这个方案调用API. NSString* urlString = [NSString stringWithFormat:@"http://api.douban.com/v2 ...

  6. css内边距 边框

    /*1 元素的各边都有 10 像素的内边距 四个值上.右.下.左 两个上下,左右 三个值:上,左右,下*/ /*p {padding: 10%;}*/ h1 { padding-top: 10px; ...

  7. JSP页面中引入另一个JSP页面

    一个JSP页面中引入另一个JSP页面,相当于把另一个JSP页面的内容复制到对应位置: <%@include file="date.jsp" %> 一般页面的top和bo ...

  8. Redis日常使用随笔

    Redis常用配置:1.采用master与slave互为主从的方式,两条重要命令:redis 127.0.0.1:6379> SLAVEOF NO ONEredis 127.0.0.1:6379 ...

  9. 7.MySQL必知必会之用通配符进行过滤-like

    用通配符进行过滤-like 1. like操作符 先说两个概念:

  10. linux常用命令:telnet 命令

    telnet命令通常用来远程登录.telnet程序是基于TELNET协议的远程登录客户端程序.Telnet协议是TCP/IP协议族中的一员,是Internet远程登陆服务的标准协议和主要方式.它为用户 ...