如何循环访问DataView

时间:2012-02-12 10:04:55

标签: vb.net loops dataview

  

可能重复:
  Looping through rows in a DataView

我已经从数据表中创建了一个数据视图。

我的问题是如何在数据视图中循环?

我知道在数据表中我可以执行这样的循环:

For Each oRow as DataRow in iDataset.Tables("tableName")
     Msgbox oRow(0).ToString
Next

我如何为DataView

执行此操作

1 个答案:

答案 0 :(得分:4)

试试这个:

For Each rowView As DataRowView in dataView
    Dim row As DataRow = rowView.Row
    Msgbox oRow(0).ToString
Next