Duplicate a record in a typed data set

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a typed data set, with two tables. This is an in memory data set,
that is there is no underlying database. I would like to duplicate a record
in one of the tables and append this record back to the same table. The idea
is to duplicate the data and have a new key is added. The key is
auto-generated. Is there a way to do this with out generating a new record
and then transferring the data one field at a time?
 
Hi Mike,

As far as I know, since a key column is here, there is no way to clone a
DataRow without transferring the data one field at a time. You can use
DataTable.NewRow or DataTable.LoadDataRow to do this.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Mike,
I am not sure what you are trying to achieve with this strategy of
duplicating a record. But ... assuming you are using 2.0, could you achieve
the same result with

myRow.AcceptChanges
myRow.SetAdded

//do whatever

//Give user choice to either Accept or Reject changes to row. If you want
the user to be able to compare original and changed datarow values, you could
do this with the datarowview.DataRowVersion property.
 
Back
Top