﻿<?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?)  » Determining if a record is new during BeforeSave event</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 05:39:31 GMT</lastBuildDate><ttl>20</ttl><item><title>Determining if a record is new during BeforeSave event</title><link>http://forum.strataframe.net/FindPost12074.aspx</link><description>I'm about to subclass the BusinessLayer type to handle some auditing.  I'll need to know if a record is a new record. I was going to override the Save method (or maybe the OnBeforeSave method). In this I'll need to figure out if the record is new. If it isn't new, I'll need to save away the old values to my audit history table, but I won't need to call this for new records.  &lt;br&gt;
&lt;br&gt;
My first thought was to check the PK field (which in my case will always be an integer/identity field), to see if its value was &lt; 0.  Is there a better way?&lt;br&gt;
&lt;br&gt;
Thanks!</description><pubDate>Fri, 19 Oct 2007 08:25:45 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Determining if a record is new during BeforeSave event</title><link>http://forum.strataframe.net/FindPost12081.aspx</link><description>Yeah, Peter has the right idea.&amp;nbsp; The best way to determine a state of a row is by using the RowState.&amp;nbsp;</description><pubDate>Fri, 19 Oct 2007 08:25:45 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Determining if a record is new during BeforeSave event</title><link>http://forum.strataframe.net/FindPost12078.aspx</link><description>Ah...great idea. I'll try that.&lt;br&gt;
&lt;br&gt;
Thanks Peter</description><pubDate>Thu, 18 Oct 2007 19:56:40 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Determining if a record is new during BeforeSave event</title><link>http://forum.strataframe.net/FindPost12075.aspx</link><description>Hi Greg,&lt;/P&gt;&lt;P&gt;I think:&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; BO.CurrentRow.RowState = DataRowState.Added &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;......&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;Will do the job&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;Cheers, Peter&lt;FONT size=2&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Thu, 18 Oct 2007 18:00:01 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>