本文整理匯總了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