DataTable - foreach 行,除了第一个 [英] DataTable - foreach Row, EXCEPT FIRST ONE

查看:35
本文介绍了DataTable - foreach 行,除了第一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

Something like:

DataTable dt;

foreach (DataRow r in dt.Rows /*EXCEPT THE FIRST ONE*/)
{
    //do something...
}

解决方案

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 行,除了第一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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