How to lock the sql area in vb

Posted on 2006-04-10
Last Modified: 2010-05-01
I have an update that I am going to do, however, I want to make sure
that no one has modified the records that I am about to update.

General logic:
Perform select statement and confirm that the row has not been changed
Update the sql database

From the time I perform the select until the time I update the database
someone else can get into the area and update it.

Do people usually handle this?  If so, how?

sql = "SELECT ModifiedDateTime From tblProcess WHERE ProcessName = name"
Set rs = objgDAL.Connection.Execute(sql)
If m_LoadDateLastModified <> rs!ModifiedDateTime Then            
              GoTo Err_Handler
End If
Set rs = Nothing
sql = " UPDATE tblProcess SET ProcessName = name"                    
objgDAL.Connection.Execute sql

Question by:swansonplace
    LVL 9

    Accepted Solution

    This issue is call Concurrency.  Google the set of following terms: Concurrency ADO timestamp

    I found a few intro articles, but they're for .net, not classic VB.  Principles are the same.

    Author Comment


    Thank you for the information.  I was able to get a design that will work.  In my case, I will create a last modified time stamp and check if the timestamp has changed before my update.

    Thanks alot.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    Article by: Martin
    Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now