本文整理汇总了VB.NET中System.Data.DataTableReader.GetDataTypeName方法的典型用法代码示例。如果您正苦于以下问题:VB.NET DataTableReader.GetDataTypeName方法的具体用法?VB.NET DataTableReader.GetDataTypeName怎么用?VB.NET DataTableReader.GetDataTypeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了DataTableReader.GetDataTypeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: TestGetTypeName
Private Sub TestGetTypeName()
Dim table As DataTable = GetCustomers()
Using reader As New DataTableReader(table)
For i As Integer = 0 To reader.FieldCount - 1
Console.WriteLine("{0}: {1}", _
reader.GetName(i), reader.GetDataTypeName(i))
Next
End Using
Console.WriteLine("Press Enter to finish.")
Console.ReadLine()
End Sub
Private Function GetCustomers() As DataTable
' Create sample Customers table, in order
' to demonstrate the behavior of the DataTableReader.
Dim table As New DataTable
' Create two columns, ID and Name.
Dim idColumn As DataColumn = table.Columns.Add("ID", _
GetType(Integer))
table.Columns.Add("Name", GetType(String))
' Set the ID column as the primary key column.
table.PrimaryKey = New DataColumn() {idColumn}
table.Rows.Add(New Object() {1, "Mary"})
table.Rows.Add(New Object() {2, "Andy"})
table.Rows.Add(New Object() {3, "Peter"})
table.Rows.Add(New Object() {4, "Russ"})
Return table
End Function