VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to add datarow in existing datatable? Posted by GeekProgrammer on 6 Jun 2012 at 3:45 AM
I have a datatable with several columns.During run time i added a column ,now i want to add rows to it.Can any one suggest how to add rows to that particular datacolumn
Report
Re: How to add datarow in existing datatable? Posted by EazyTalkInc on 10 Jun 2012 at 8:21 PM
'test datatable
        Dim dt As New DataTable
        dt.Columns.Add("col1")
        dt.Columns.Add("col2")

        'add new row
        Dim dr As DataRow
        dr = dt.NewRow()
        dr.Item(0) = "row1col1"
        dr.Item(1) = "row1col2"
        dt.Rows.Add(dr)

        'add dynamic column
        dt.Columns.Add("col3")

        'add value to column
        dr.Item(2) = "row1col3"

________________________________________________________
www.eazytalkinc.com
Report
Re: How to add datarow in existing datatable? Posted by EazyTalkInc on 10 Jun 2012 at 8:25 PM
.....
________________________________________________________
www.eazytalkinc.com



 

Recent Jobs