Results 1 to 5 of 5

Thread: Copy data from one datatable to another datatable

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Copy data from one datatable to another datatable

    I created a datatable(dt1) form a text file.

    The third column store data like

    aaa,2012,693.20

    bbb,2013,55.02

    How to code to split out date from one column to three columns in another datatable(dt2) like below?

    NAME--DATE-AMOUNT

    aaa-----2012-693.20

    bbb----2013-55.02

  2. #2
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: Copy data from one datatable to another datatable

    Select the date from one table. Store it into an array. And then Insert to the other tables.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,976

    Re: Copy data from one datatable to another datatable

    Use the TextFieldParser to read the text file and split it into three fields in the first place.
    There's a thread lying about here someplace where this was talked about and I provided some sample code of a generic process I use to accomplish this. It's surprisingly simple and easy.
    I'll see if I can find it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,976

    Re: Copy data from one datatable to another datatable

    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Copy data from one datatable to another datatable

    Thank you, techgnome.
    I will learn this way.
    Since I already spent a few days and almost getting there, I want to learn how to create datatable to complete the project.
    The project will search some record in datatable and creaete a report to boss.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width