Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy a DataTable from one DataSet to another DataSet
Message
From
13/10/2006 11:32:05
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01161735
Message ID:
01161789
Views:
18
Wouldn't it be:

targetDs.Tables.Add( ...Clone() )

Cetin

>John,
>I get the following compiler error:
>
>Property or indexer 'System.Data.DataTableCollection.this[string]' cannot be assigned to -- it is read only
>
>
>>Einar:
>>
>>DataTable ds1.Tables[0] = DataSetds2.Tables[0].Copy() produces a deep copy....(structure and data)
>>DataTable ds1.Tables[0] = DataSetds2.Tables[0].Clone() produces a copy of the structure only.
>>
>>
>>>>I have two different datasets: datasetA and datasetB
>>>>>
>>>>>Both datasets contain the same table SameTable.
>>>>>
>>>>>How do I copy/duplicate the table from datasetA to datasetB?
>>>>>
>>>>>This does not work: datasetB.SameTable = datasetA.SameTable
>>>>>
>>>>>Thanks,
>>>>>Einar
>>>>
>>>>Einar,
>>>>
>>>>I think that you will have to copy the rows one by one because there are a lot of back links in a DataTable.
>>>
>>>Hmmm that was not the answer I wanted :) That was the answer I came up with myself :)
>>>The reason I posted my questions was to "verify" that there wasn't another way.
>>>Thanks for your reply.
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform