• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

How to lock the sql area in vb

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
swansonplace
Asked:
swansonplace
1 Solution
 
dancebertCommented:
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
 
swansonplaceAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now