468,733 Members | 1,611 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,733 developers. It's quick & easy.

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

Is there an easy way to do this?
Jul 21 '05 #1
2 9011
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
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.