Copy the rows of Datatabe to another DataTable

Source: Internet
Author: User

sometimes we need to make a complex filter for each row of a DataTable, and then filter out the rows to be added to another DataTable:
for example: DT. Rows.Add (DR) if the DR is coming to another DataTable, it will be an error: Dr is already part of another DataTable
This is what we need to use: dt. Rows.Add (Dr.ItemArray) is equivalent to copying an array and adding it to the new DataTable


Here is an example of copying a row of DT1 data into a DT2
dim dt1=executeselect ("SELECT * from dual")    
dim dt2=dt1. Clone ()

for each Dr. in Dt1. rows      

    DT2. Rows.Add (Dr. ItemArray)
NEXT 

Original address: http://bbs.delit.cn/thread-649-1-1.html

Reprint please specify the source:

Author: metric Technology http://bbs.delit.cn/thread-649-1-1.html

Copy the rows of Datatabe to another DataTable

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.