直接Linq查询以搜索包含特定值的所有单元格 [英] Direct Linq query to search all the cells that contains a specfic value

查看:148
本文介绍了直接Linq查询以搜索包含特定值的所有单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我一直在浏览网页以搜索直接的LINQ查询,该查询允许我获取包含特定值的所有单元格。 />


得到行的是:



Hi,

I have been browsing the web to search for a direct LINQ query that allows me to get all the cells that contains a specific values.

the one to get the rows is:

(from DataRow r in dtableInput.Rows
                                        where r.ItemArray.Any(c => c.ToString().Contains("Keyword"))
                                        select r).ToArray();





我需要得到每个细胞的位置。任何人都可以帮忙吗?



提前谢谢



I need to get the position of each cell. Can anyone help?

Thanks in advance

推荐答案

这是你应该使用的。它的LINQ支持遗留的ADO东西,如DataTable / DataView(s)/ DataRow(s)等等





< a href =http://msdn.microsoft.com/en-us/library/bb386977.aspx> http://msdn.microsoft.com/en-us/library/bb386977.aspx



以下是其用法示例: http ://msdn.microsoft.com/en-us/library/bb552415.aspx
This is what you should use. Its LINQ support for legacy ADO stuff, like DataTable(s)/DataView(s)/DataRow(s) etc etc


http://msdn.microsoft.com/en-us/library/bb386977.aspx

And here is an example of its usage : http://msdn.microsoft.com/en-us/library/bb552415.aspx


实际上我必须浏览行然后浏览每行的列。这个解决方案允许我使用Rows.IndexOf和Columns.IndexOf来获取行和列的索引。



我不确定这是最好的实现,但它现在有所帮助。

谢谢大家
Actually I had to brows rows then browse columns for each rows. This solution allowed me to get the index of the rows and columns using Rows.IndexOf and Columns.IndexOf.

I'm not sure this is the best implementation but it helps for now.
Thank you all


这篇关于直接Linq查询以搜索包含特定值的所有单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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