DataTable - foreach Row,EXCEPT FIRST ONE [英] DataTable - foreach Row, EXCEPT FIRST ONE
本文介绍了DataTable - foreach Row,EXCEPT FIRST ONE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的应用中使用 DataTable
进行一些计算。我需要通过除第一行之外的所有行进行迭代。有可能吗?
I am using a DataTable
for some calculations in my app. I need to do the iterate trough all the rows except the first one. Is it possible?
类似于:
DataTable dt;
foreach (DataRow r in dt.Rows /*EXCEPT THE FIRST ONE*/)
{
//do something...
}
推荐答案
好的,你得到了答案,但万一你不想使用linq。检查表中行的索引:
Ok you got your answers but in case you donT want to use linq. Check the index of the row in the table:
foreach (DataRow row in m_dtMatrix.Rows)
{
if (m_dtMatrix.Rows.IndexOf(row) != 0)
{
...
}
}
这篇关于DataTable - foreach Row,EXCEPT FIRST ONE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文