| Dim r As DataRow
For Each t In ds.Tables
For Each r In t.Rows
For Each c In t.Columns
If Not r.IsNull(c) Then Console.WriteLine(r(c).ToString())
Next c
Next r
Next t
End Sub
n Overloads Public Overridable Function Add(ByVal values() As Object) As DataRow’ 如果在 ColumnChanging 或 RowChanging 事件过程中生成异常,则也可发生异常。如果发生异常,则不向表中添加行。
n Overloads Public Sub Add(ByVal row As DataRow)’ 如果用户在 RowChanging 事件中生成异常,则生成异常。如果发生异常,则不向表中添加行。
示例
Private Sub AddRow(ByVal myTable As DataTable)
Dim rc As DataRowCollection= myTable.Rows
Dim myNewRow As DataRow
Dim rowVals(1) As Object
rowVals(0) = "hello"
rowVals(1) = "world"
myNewRow = rc.Add(rowVals)
newRow = myTable.NewRow()
newRow(0) = "hello"
newRow(1) = "world"
rc.Add(newRow)
End Sub
(信息整理来自MSDN)
上一页 [1] [2] |