如何新建一个DataSet,并且插入相应的数据

 'init 0 to 23 ingition percent
        Dim table As DataTable = New DataTable("Table")
        Dim column As DataColumn
        Dim row As DataRow
        column = New DataColumn()
        column.DataType = System.Type.GetType("System.DateTime")
        column.ColumnName = "hour"
        column.ReadOnly = True
        table.Columns.Add(column)
        column = New DataColumn()
        column.DataType = System.Type.GetType("System.Int32")
        column.ColumnName = "percent"
        column.ReadOnly = False
        table.Columns.Add(column)
        Me.DS.Tables.Add(table)
        For i As Integer = 0 To 23
            row = table.NewRow()
            row("hour") = DateAdd("h", i, "1900-1-1 00:00:00")
            row("percent") = 0
            table.Rows.Add(row)
        Next
        Me.DS.AcceptChanges()

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页