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

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.