vb System.Data.DataColumn类(方法)实例源码

下面列出了vb System.Data.DataColumn 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Dat   
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


问题


面经


文章

微信
公众号

扫码关注公众号