By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

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

P: n/a
Is there an easy way to do this?
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.