Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy a DataTable from one DataSet to another DataSet
Message
De
13/10/2006 13:20:46
 
 
À
13/10/2006 12:53:20
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01161735
Message ID:
01161848
Vues:
17
>Remove is not an option in Intellisense for VB. Is this a C# thing?

Sorry John, I guess I should have posted code. It's a method of the DataTableCollection, not the DataTable itself. So, it would be:
Dim SampleTable As DataTable
SampleTable = dataSetA.SameTable.Copy()
dataSetB.Tables.Remove("SameTable")
datasetB.Tables.Add(SameTable)
~~Bonnie


>
>
>>>
>>>Dim SampleTable As DataTable
>>>SampleTable = dataSetA.SameTable.Copy()
>>>dataSetB.SameTable.Dispose()
>>>datasetB.Tables.Add(SameTable)
>>>
>>
>>John, the Dispose won't work, but you can do it with a Remove().
>>
>>Einar, try using the Merge method. Something like this:
>>
>>
>>datasetB.SameTable.Clear();
>>datasetB.SameTable.Merge(datasetA.SameTable);
>>
>>
>>~~Bonnie
>>
>>
>>
>>>
>>>HTH
>>>John
>>>
>>>>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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform