﻿<?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?)  » Concurrency Using RowVersion Problem</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 17:45:09 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost25420.aspx</link><description>Hi Jeff.&lt;/P&gt;&lt;P&gt;Have a look at this post: &lt;A href="http://forum.strataframe.net/FindPost6191.aspx"&gt;http://forum.strataframe.net/FindPost6191.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Follow it and I think you will find some good information about concurrency.&lt;/P&gt;&lt;P&gt;Hope it helps.</description><pubDate>Thu, 17 Dec 2009 05:48:43 GMT</pubDate><dc:creator>Ivan George Borges</dc:creator></item><item><title>Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost15079.aspx</link><description>Hi Guys,&lt;P&gt;As I have said before, I am a part time programmer and seem to be little rusty all of the time.&amp;nbsp; With that said, after following the help instructions, I am unable to get SF concurrency using RowVersioning&amp;nbsp;to work.&amp;nbsp; User A and User B are editing the same record at the same time using the code below.&amp;nbsp; User A saves the record.&amp;nbsp; Then User B saves the record and the BO does not throw an exception.&amp;nbsp; What am I doing wrong?&amp;nbsp;&lt;IMG title=Crazy src="http://forum.strataframe.net/Skins/Classic/Images/MessageIcons/Crazy.gif" align=absMiddle&gt; Thanks for the help!&lt;/P&gt;&lt;P&gt;I have the following properties set on the ContactsBO:&lt;/P&gt;&lt;P&gt;CollisionNoficationType = ThrowException&lt;/P&gt;&lt;P&gt;RowVersionOrTimestampColumn = ContactRowVersion (datatype int - allow nulls)&lt;/P&gt;&lt;P&gt;UpdateConcurrencyType = OptimisticRowVersion&lt;/P&gt;&lt;P&gt;Code Below..............................&lt;/P&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;Using&lt;/FONT&gt;&lt;FONT size=2&gt; loBO &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;New&lt;/FONT&gt;&lt;FONT size=2&gt; ContactsBO&lt;/P&gt;&lt;P&gt;loBO.FillByPrimaryKey(contactID)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; loBO.IsEmpty &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&amp;nbsp; loBO.Edit()&lt;/P&gt;&lt;P&gt;&amp;nbsp; loBO.UserID = GlobalVariables.CurrentUserID&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;loBO.Save()&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;True&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;/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;Using&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Catch&lt;/FONT&gt;&lt;FONT size=2&gt; ex &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; MicroFour.StrataFrame.Data.DataLayerException&lt;/P&gt;&lt;P&gt;MsgBox(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"DataLayerException ex = "&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; ex.Message)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Catch&lt;/FONT&gt;&lt;FONT size=2&gt; ex &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; MicroFour.StrataFrame.Data.DataLayerSavingException&lt;/P&gt;&lt;P&gt;MsgBox(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"DataLayerSavingExeption ex = "&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; ex.Message)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Catch&lt;/FONT&gt;&lt;FONT size=2&gt; ex &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; MicroFour.StrataFrame.Data.RowNotUpdatedException&lt;/P&gt;&lt;P&gt;MsgBox(&lt;/FONT&gt;&lt;FONT color=#800000 size=2&gt;"RowNotUpdateExeption ex = "&lt;/FONT&gt;&lt;FONT size=2&gt; &amp;amp; ex.Message)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Catch&lt;/FONT&gt;&lt;FONT size=2&gt; ex &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;As&lt;/FONT&gt;&lt;FONT size=2&gt; Exception&lt;/P&gt;&lt;P&gt;Ems.HandleException(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;&lt;FONT size=2&gt;, ex)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Return&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;False&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;Try&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Thu, 17 Dec 2009 05:48:43 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost25418.aspx</link><description>In the ConcurrencyExeption event, I have set the &lt;FONT size=2&gt;e.ResaveRecord = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;True, but the SF Softcollision form is still appearing.&amp;nbsp; I thought if I set the e.ResaveRecord if would force the local record to be saved and the SF softcollision form will NOT appear.&amp;nbsp; Is there way to handle this so that the SF softcollision form does not appear to the user?&amp;nbsp; Please explain the best practices in this case.&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff&gt;I am using OptimisticRowVersion.&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Thanks,&lt;/FONT&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;Jeff&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Wed, 16 Dec 2009 12:36:44 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost15123.aspx</link><description>By default, you can capture the ConcurrencyException event on the business object.&amp;nbsp; When the second user goes to save and the concurrency exception is detected, that event will be raised.&amp;nbsp; However, if you change the CollisionNotificationType property on the business object to ThrowException, then a DataLayerSavingException will be thrown that contains the information about the concurrency exception that was encountered.&amp;nbsp; &lt;/P&gt;&lt;P&gt;So, it's really up to you as to how you want to handle the error.&amp;nbsp; If you capture the event, you can set the Resave property on the event args to True and the data layer will re-save the record after the event handler returns and you're original call to Save() will never know there was an error.&amp;nbsp; If you catch the exception, then you'll need to call Save() again after you're done what you want to with the data.</description><pubDate>Mon, 24 Mar 2008 08:32:29 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost15114.aspx</link><description>Hi Trent,&lt;/P&gt;&lt;P&gt;I am not using CRUD or DDT.&amp;nbsp; As I show you in the code, I am just using the BO.Fill, BO.Edit and&amp;nbsp;BO.Save methods to update a field.&amp;nbsp; Therefore, how do I handle or trap for the concurrency issue using SF when User A and User B are editing and updating the field at the same time?&lt;/P&gt;&lt;P&gt;Thanks.</description><pubDate>Sat, 22 Mar 2008 22:45:57 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Concurrency Using RowVersion Problem</title><link>http://forum.strataframe.net/FindPost15084.aspx</link><description>Well the good news is that I know that there isn't an issue with the RowVersion concurrency...this is probably the most common concurrency logic used :).&amp;nbsp; So we will want to look at your code a little closer.&lt;/P&gt;&lt;P&gt;First, I am not sure what you are trying to accomplish by catching all of the individual exception types...I assume that you have some need for this in your application...so we can just skip over that for now.&amp;nbsp; Second, you will not want to allow NULLs on the row version field...bad mojo could come :D&amp;nbsp; Next, you will need to indicate whether you are using CRUD settings, etc. If you are using the DDT and allowing the sprocs to be created for you, did you set the row version column on the table properties?&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forum.strataframe.net/Uploads/Images/5d6f2e42-a34c-4a0f-aff9-381b.png"&gt;&lt;/P&gt;&lt;P&gt;You will also notice in that screen shot that the UPDATE procedure will need to have the concurrency set to Optimistic Row Version as well.&lt;/P&gt;&lt;P&gt;Also, you should just set the BO CRUD properties on through the BO designer versus in code each time...it you are going to have the same concurrency type each time, which you should.&lt;/P&gt;&lt;P&gt;Finally, you will want to handle the COncurrencyException event versus trying to catch the exception as you currently are.&amp;nbsp; If there is a concurrency collision, the ConcurrencyException event will be raised...that is where you will want to place your logic...not a bunch of Try/Catches.&lt;/P&gt;&lt;P&gt;Hopefully one of these suggestions should get you going. :)</description><pubDate>Fri, 21 Mar 2008 10:07:01 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>