16,554
社区成员
发帖
与我相关
我的任务
分享
Private Sub PrintRows(ByVal dataSet As DataSet)
Dim table As DataTable
Dim row As DataRow
Dim column As DataColumn
' For each table in the DataSet, print the row values.
For Each table in dataSet.Tables
For Each row In table.Rows
For Each column in table.Columns
Console.WriteLine(row(column))
Next column
Next row
Next table
End Sub
Dim table As DataTable
table = MakeNamesTable()
' Once a table has been created, use the
' NewRow to create a DataRow.
Dim row As DataRow
row = table.NewRow()
' Then add the new row to the collection.
row("fName") = "John"
row("lName") = "Smith"
table.Rows.Add(row)
Dim column As DataColumn
For Each column In table.Columns
Console.WriteLine(column.ColumnName)
Next
' DataGridView1.DataSource = table
原来是这样使用。