Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cloning a row
Message
From
29/12/2006 18:50:42
Jeff Corder
Ambit Technologies, LLC
Missouri, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Cloning a row
Miscellaneous
Thread ID:
01181002
Message ID:
01181002
Views:
71
I am attempting to create a duplicate row in a SQL table. The table has a primary key, so I get an error if I just copy the row back into the same table. I'm using an intermediate business object so I can change the Primary Key before I save the data. Unfortunately, it isn't working.


POs oPO = new POs(); // MM Business Object
POs oPONew = new POs(); //

// Code to retrieve record in oPO

// Works fine, data is inserted into oPONew table[0]
oPONew.DataSet.Tables[0].ImportRow(oPO.DataRow);

// When I check oPONew.DataSet.Tables[0].Rows[0], it has the correct data]
// This line does not set the entity of oPONew. It remains empty and .DataRow = null
oPONew.Entity.SetDataRow(oPONew.DataSet.Tables[0].Rows[0]);



I looked through the MM code, and according to the documentation, the .DataRow property is set to the first row in the data returned from the query (no mention of it changing). However, when I followed the code for the Entity, the Get uses the DataRow property. It doesn't seem to be set. I was under the impression that using the .SetDataRow() would also change the DataRow property, but in .SetDataRow() it's only changing Row in the business entity.

Obviously I'm missing something here.

Thanks for the help,
Jeff Corder
Next
Reply
Map
View

Click here to load this message in the networking platform