How to make a copy of a datatable?

  • Thread starter Thread starter cj
  • Start date Start date
C

cj

If I have a dataset with a datatable and I want to make a copy of this
in a different datatable. I've tried:
MyDt = MyDs.Tables("testTable")
Problem is when I later in code issue:
MyDt.clear()
it clears MyDs.Tables("testTable") also.

How can this be accomplished?
 
cj said:
If I have a dataset with a datatable and I want to make a copy of this
in a different datatable. I've tried:
MyDt = MyDs.Tables("testTable")
Problem is when I later in code issue:
MyDt.clear()
it clears MyDs.Tables("testTable") also.

How can this be accomplished?

MyDt = MyDs.Tables("testTable").Copy


Tom
 
Tomb,

Looking at your (message about online help)

In fact is the datatable.copy a little confusing one. It is as far as I know
the only collection which has an inbuild deep copy method, so people could
expect that it standard not there.

:-)

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top