471,049 Members | 1,305 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

How do I copy one dataset table to another dataset table?

Is there an easy way to do this?
Jul 21 '05 #1
2 9245
Keeping in mind that datatables are Reference types and the copy is simply
a copy of the reference (ie any changes you make to the copy will be
reflected in the original), this should work for you:

Dim dt As New DataTable

Dim dt2 As New DataTable

Dim ds1 As New DataSet

Dim ds2 As New DataSet

ds1.Tables.Add(dt)

dt2 = dt.Copy()

ds2.Tables.Add(dt2)

However, you can make a deep copy wherin you create a new table and set each
value of the new field to the value of the sourdce...

"Top Gun" <nf*@nospam.com> wrote in message
news:OY**************@tk2msftngp13.phx.gbl...
Is there an easy way to do this?

Jul 21 '05 #2
Cor
Hi Bill are you sure of that?
Keeping in mind that datatables are Reference types and the copy is simply
a copy of the reference (ie any changes you make to the copy will be
reflected in the original), this should work for you:


Datatable.copy
A new DataTable with the same structure (table schemas and constraints) and
data as this DataTable.

What you say is as far as I know.
DataTable Dt;
Dt = DtOld;

But maybe I am wrong?

:-)

Cor
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by suzy | last post: by
1 post views Thread by Jeroen Pot | last post: by
7 posts views Thread by lgbjr | last post: by
4 posts views Thread by JIM.H. | last post: by
4 posts views Thread by Soulless | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.