473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to make a copy of a datatable?

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?
Dec 15 '05 #1
3 1389
cj wrote:
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
Dec 15 '05 #2
cj
Thanks!

tomb wrote:
cj wrote:
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

Dec 15 '05 #3
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

"tomb" <to**@technetcenter.com> schreef in bericht
news:Ex*******************@bignews6.bellsouth.net. ..
cj wrote:
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

Dec 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dianna K. | last post by:
I have a dataview which I am assigning to a Datatable (I am doing this because currently Crystal Reports will not accept a dataview as a Reportsource -- The recommended work-around is to assign...
3
by: Matthew Wieder | last post by:
I have a datatable as a source and I need to produce a datatable which is all the rows in the original datatable except the first row, copied n times. So, if I had a datatable of: A B C...
1
by: bubby | last post by:
Should I be concerned about the classic "Deep/Shallow" copy problem when returning objects, specifically a DataTable or DataView from a method? For example, see the code below: private...
12
by: Bob | last post by:
I have some data in a DataTable object that I'd like to put into a static class for the entire app to use, kind of like a cahced global value. The data in there should not change, but DataTable by...
4
by: JIM.H. | last post by:
Hello, I am trying to write the data I got from a web service to my table in SQL Server I need to append the dataset wsDS to the dataset ds and do update. PVS.myWS.Loader load = new...
0
by: mikejacobz | last post by:
Hi, I have a Datatable which I would like to copy into two other DataTables. The first copy of the DataTable would contain the first 1/2 of the original DataTable whilst the second DataTable...
1
by: ceestand | last post by:
I am having a weird (to me at least) problem retrieving a copy of an item in the Cache. I do something like this: DataTable ToBeInserted = FunctionThatReturnsDataTable();...
3
by: Manuel | last post by:
Hi to all, I'm trying to copy a Datacolumn from a table to another, but with this code: destTable.Columns.Add(srcTable.Column); I got this error: Column 'colname' already belongs to another...
1
by: SunshineInTheRain | last post by:
Dim dtUn As DataTable dtUn= New DataTable dtUn = BindICUN() Dim i As Integer Dim irow As DataRow Dim mailBody As String = "" Dim myRow As...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.