Scott M.
3/16/2008 6:54:00 PM
Yes Cor, I know how to copy the individual values out of a row. I was
hoping to not have to do that though.
Thanks,
Scott
"Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
news:71BF9C97-1B4B-45F4-94B7-1A678662DF80@microsoft.com...
> Scott,
>
> Then you have to copy the values and not the references in that.
>
> You can simple do that by using a for each loop through the DataColumns,
> the only problem is that you can use the datacolumn from the references
> table and have for the other one the DataColumn.Name (The string).
>
> Cor
>
> "Scott M." <smar@nospam.nospam> schreef in bericht
> news:OuFcsh3hIHA.4844@TK2MSFTNGP06.phx.gbl...
>> Thanks Cor, but this is not what I'm looking for.
>>
>> I want to make a copy of the DataRow object (and thus the data in the
>> DataRow), so that the copy can exist in a separate DataTable than the
>> first one. I'm not talking about a second variable reference.
>>
>>
>> -Scott
>>
>> "Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
>> news:598B0B28-18B5-49DC-9DC2-A4C36A15FD76@microsoft.com...
>>> Scott,
>>>
>>> Whatever you copy, then it is always a shalow copy of the copied one.
>>>
>>> By instance this code (version 2008 type VB)
>>>
>>> \\>>> Dim scottsSet As New Scott
>>> Dim scottsTable = scottsSet.DataTable1
>>> Dim firstRow = scottsTable.NewDataTable1Row
>>> firstRow.DataColumn1 = "One"
>>> firstRow.DataColumn2 = "two"
>>> scottsTable.AddDataTable1Row(firstRow)
>>>
>>> Dim corsSet As New Scott
>>> corsSet.Merge(scottsTable)
>>> ///
>>>
>>> Here the scottsSet and the corsSet are in fact completely the same and
>>> reference to the same data. (a change in the corsSet is in fact the same
>>> as in the scottsSet).
>>>
>>> This is because you are in fact only working with references. To add
>>> values to the datarows you have really to set the items to values.
>>>
>>> I assume you knew this already however wanted it to be showed by
>>> somebody else.
>>>
>>> Cor
>>>
>>>
>>>
>>> "Scott M." <smar@nospam.nospam> schreef in bericht
>>> news:Oz3s%23KthIHA.2304@TK2MSFTNGP05.phx.gbl...
>>>> Hi Cor,
>>>>
>>>> As I said the row I want to copy will be placed into another
>>>> typed-dataset of the same type, so there will be no issuse with column
>>>> mapping.
>>>>
>>>> -Scott
>>>>
>>>> "Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
>>>> news:1CF300D0-058C-444E-9765-FC87CEB00C6E@microsoft.com...
>>>>> Scott,
>>>>>
>>>>> It depends if it is for the same datatable or that you want to put it
>>>>> in an other datatable.
>>>>>
>>>>> As you know is the datarow using the columns descriptions from the
>>>>> datatable, that is the reason that you never can copy whatever datarow
>>>>> to another table. (The datarow has even one property table, which
>>>>> tells to what tables it belongs (get its columns from)).
>>>>>
>>>>> Be aware that with strongly typed datasets the merge is an important
>>>>> method, while it is in my idea with non typed ones mostly ignored.
>>>>>
>>>>> Cor
>>>>>
>>>>> "Scott M." <smar@nospam.nospam> schreef in bericht
>>>>> news:uttKc9rhIHA.5824@TK2MSFTNGP03.phx.gbl...
>>>>>>I need to copy an entire row of a typed DataSet so that I can place it
>>>>>>into a different instance of the same type of typed DataSet. I don't
>>>>>>see a clone or copy method on the DataRow. Do I have to create and
>>>>>>populate the row manually?
>>>>>>
>>>>>> -Scott
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>