本文整理匯總了VB.NET中System.Data.DataColumn類的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataColumn類的具體用法?VB.NET DataColumn怎麽用?VB.NET DataColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DataColumn類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: MakeTable
Private Sub MakeTable()
' Create a DataTable.
Dim table As New DataTable("Product")
' Create a DataColumn and set various properties.
Dim column As New DataColumn()
column.DataType = System.Type.GetType("System.Decimal")
column.AllowDBNull = False
column.Caption = "Price"
column.ColumnName = "Price"
column.DefaultValue = 25
' Add the column to the table.
table.Columns.Add(column)
' Add 10 rows and set values.
Dim row As DataRow
Dim i As Integer
For i = 0 to 9
row = table.NewRow()
row("Price") = i + 1
' Be sure to add the new row to
' the DataRowCollection.
table.Rows.Add(row)
Next i
End Sub