如何读取数据表中的行 [英] How to read a row iin a datatable

查看:78
本文介绍了如何读取数据表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在一个函数中读取一行的值,代码如下:


Hi I wish to read in a function the values of a row with the following code

DataRow TrimChamps(DataRow row)
        {
            foreach (DataRow.columns col in row)
            {
            }
            return row;
        }



但是DataRow没有columns属性。

如何解决它而不必传递给函数整个DataTable作为参数?

谢谢

Bernard



我尝试了什么:




But DataRow don't have the columns property.
How to solve it without having to pass to the function the whole DataTable as a parameter?
Thanks
Bernard

What I have tried:

DataRow TrimChamps(DataRow row)
        {
            foreach (DataRow.columns col in row)
            {
            }
            return row;
        }

推荐答案

您可以使用 DataRow.ItemArray属性(System.Data) [ ^ ]


这篇关于如何读取数据表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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