﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » How to use CopyDataFrom to add a new record?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 14 Sep 2026 20:55:07 GMT</lastBuildDate><ttl>20</ttl><item><title>How to use CopyDataFrom to add a new record?</title><link>http://forum.strataframe.net/FindPost24940.aspx</link><description>Hi,&lt;br&gt;
&lt;br&gt;
I am trying to use the CopyDataFrom method to copy the contents of one BO into an empty second BO and to then assign new primary keys to the second BO so that I can add them as new records. However, when I do this and save, it overwrites the original records with the new primary keys and no new records are added.&lt;br&gt;
&lt;br&gt;
I think I am missing something to get the records in the second BO added instead of updated.&lt;br&gt;
&lt;br&gt;
Is this the best way to take a record and duplicate it? If so, have I missed something?&lt;br&gt;
&lt;br&gt;
Thanks in advance,&lt;br&gt;
&lt;br&gt;
Aaron&lt;br&gt;</description><pubDate>Mon, 19 Oct 2009 15:52:21 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: How to use CopyDataFrom to add a new record?</title><link>http://forum.strataframe.net/FindPost24947.aspx</link><description>You are welcome Aaron.&lt;br&gt;
&lt;br&gt;
There is also an enhancement request to add a property or flag to the BO.CopyDataFrom to update the row state in a single pass.  Hope to see that enhancement soon ;)</description><pubDate>Mon, 19 Oct 2009 15:52:21 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to use CopyDataFrom to add a new record?</title><link>http://forum.strataframe.net/FindPost24946.aspx</link><description>Hi Edhy,&lt;br&gt;
&lt;br&gt;
Thanks for that - it worked :)&lt;br&gt;
&lt;br&gt;
Think I was getting hung up on trying to make the BO change editing state to adding. This method doesn't need that at all.&lt;br&gt;
&lt;br&gt;
Thanks again.&lt;br&gt;
&lt;br&gt;
Aaron</description><pubDate>Mon, 19 Oct 2009 15:02:43 GMT</pubDate><dc:creator>Aaron Young</dc:creator></item><item><title>RE: How to use CopyDataFrom to add a new record?</title><link>http://forum.strataframe.net/FindPost24943.aspx</link><description>Hi Aaron,&lt;br&gt;
&lt;br&gt;
When you use the BO.CopyDataFrom() it will ignore the Row State so you will need to loop the copied records and set the Row State, the code below should do the trick:&lt;br&gt;
[quote]&lt;br&gt;
For Each StockBO As bizTransactionItemsStock In Me.BizTransactionItemsStock1.GetEnumerable()&lt;br&gt;
     StockBO.CurrentRow.SetAdded()&lt;br&gt;
Next&lt;br&gt;
&lt;br&gt;
[/quote]</description><pubDate>Mon, 19 Oct 2009 10:45:39 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>