Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to lock the sql area in vb

Posted on 2006-04-10
2
Medium Priority
?
207 Views
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

Issue:
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?

Details:
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
rs.Close
Set rs = Nothing
                                               
sql = " UPDATE tblProcess SET ProcessName = name"                    
objgDAL.Connection.Execute sql

0
Comment
Question by:swansonplace
2 Comments
 
LVL 9

Accepted Solution

by:
dancebert earned 2000 total points
ID: 16422296
This issue is call Concurrency.  Google the set of following terms: Concurrency ADO timestamp -.net

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

http://www.eggheadcafe.com/articles/20050719.asp
http://msdn2.microsoft.com/en-US/library/aa0416cz(VS.80).aspx
0
 

Author Comment

by:swansonplace
ID: 16426654
Dancebert,

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.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 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