本文整理匯總了VB.NET中System.Data.DataSet.Tables屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataSet.Tables屬性的具體用法?VB.NET DataSet.Tables怎麽用?VB.NET DataSet.Tables使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Data.DataSet
的用法示例。
在下文中一共展示了DataSet.Tables屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: PrintRows
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
示例2: MainClass
' 導入命名空間
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Data
Public Class MainClass
Shared Sub Main()
Dim da As New SqlDataAdapter( _
"SELECT ID, FirstName, LastName FROM Employee", _
"Server=(local)\SQLEXPRESS;Initial Catalog=MyDatabase;Integrated Security=SSPI")
Dim ds As New DataSet("Employee")
da.FillSchema(ds, SchemaType.Source)
ds.ReadXml("Employee.xml")
Dim Table As DataTable = ds.Tables(0)
Dim numCols As Integer = Table.Columns.Count
Dim Row As DataRow
For Each Row In Table.Rows
Dim i As Integer
For i = 0 To numCols - 1
Console.WriteLine(Table.Columns(i).ColumnName & " = " & Row(i))
Next
Console.WriteLine()
Next
End Sub
End Class