﻿<?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 lock a record?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 30 May 2026 06:33:02 GMT</lastBuildDate><ttl>20</ttl><item><title>How to lock a record?</title><link>http://forum.strataframe.net/FindPost22986.aspx</link><description>I have the need to update a field "InStockQty" with an accumulated value of "InStockQty + 100" or some other value.  In VFP I used "RLOCK" to lock the record and make sure my update is done before allowing somebody else to update this field, now how can I do the same with SF/.NET/MS-SQL?&lt;br&gt;</description><pubDate>Thu, 06 Oct 2011 07:50:03 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost30395.aspx</link><description>Hi Gerard,&lt;br/&gt;In this particular case I decided to use a BO.CustomFieldProperty (CFP) to show this value and calculate it on the fly with a stored procedure (SP).&lt;br/&gt;&lt;br/&gt;Since through a Business Binding Source (BBS) you can read a BO in a report, it works just fine as long as the SP is optimized.&amp;nbsp; For other cases I simply use a BO transaction to save the data, not sure it will work as the VFP RLOCK.&lt;br/&gt;&lt;br/&gt;Make sure you check out article links posted by Trent here since they are very interesting.</description><pubDate>Thu, 06 Oct 2011 07:50:03 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost30394.aspx</link><description>Hi Edhy.&lt;br/&gt;&lt;br/&gt;I realise this is a fairly old thread , but I have a similar issue now and want to 'Lock' a record for similar Stock type update.&lt;br/&gt;&lt;br/&gt;Just wondering if you would care to share what you did in the end here ?</description><pubDate>Thu, 06 Oct 2011 04:43:58 GMT</pubDate><dc:creator>Ger Cannoll</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost23016.aspx</link><description>Hi Peter,&lt;br&gt;
Thanks for the advice, I really have not experience with SQL Triggers, but will sure check it out.</description><pubDate>Mon, 04 May 2009 20:13:32 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost23015.aspx</link><description>Hi Edhy,&lt;br&gt;
&lt;br&gt;
Not sure what the logic is here but don't forget the good old SQL trigger for keeping data values in sync.&lt;br&gt;
&lt;br&gt;
Cheers, Peter</description><pubDate>Mon, 04 May 2009 17:36:43 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost22990.aspx</link><description>This is really the best way.&amp;nbsp; :)</description><pubDate>Fri, 01 May 2009 09:17:38 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost22989.aspx</link><description>Thanks Trent,&lt;br&gt;
I think I will go with the Transaction since I want to try to keep all logic at the BO level since part of this application will escalate to be a Web Application.</description><pubDate>Fri, 01 May 2009 09:15:45 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: How to lock a record?</title><link>http://forum.strataframe.net/FindPost22988.aspx</link><description>OK, this can get to be a complex topic.&amp;nbsp; However, there are in fact lots of examples out there on how to do this.&amp;nbsp; As you have probably already determined, doing this on a BO is not going to do any good as the data is disconnected.&amp;nbsp; You are going to have to do this as the SQL level.&lt;/P&gt;&lt;P&gt;There are a lot of samples out there.&amp;nbsp; Here are a few:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.wwwcoder.com/tabid/68/type/art/parentid/191/site/6508/default.aspx"&gt;http://www.wwwcoder.com/tabid/68/type/art/parentid/191/site/6508/default.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sqlteam.com/article/introduction-to-locking-in-sql-server"&gt;http://www.sqlteam.com/article/introduction-to-locking-in-sql-server&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Another point here.&amp;nbsp; Depending on what you are trying to do, concurrency may be an option as well as record locking can very easily tie into concurrency.&amp;nbsp; For example, if you are using row versioning, it would be very easy to determine if someone else has touched that record when you save.&amp;nbsp; If so, then you can take it into account.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Another option would be transactions.&amp;nbsp; Going through transactions can also play into the process here as when you start a transaction you can prevent anyone else from touching the records until the transaction is complete.&amp;nbsp; This is actually the approach that we take in our medical software when this could be a potential issue.</description><pubDate>Fri, 01 May 2009 09:07:24 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>