本文整理汇总了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