Solved

Unlock records

Posted on 2002-04-18
1
922 Views
Last Modified: 2013-12-25
i am developing a VB6 application connecting to ORACLE 8.0. database. i have a question, how can i unlock a record without disconnecting?

  the problem is like this. i make a connection to the database when the user start the app. when the user open a form, i lock a certain record so others won't be able to change the record by using "SELECT .... FOR UPDATE". so if the user opened more than 1 forms, i would have lock a few records using the same connection. when the user exit a form, i would like to unlock the record that was previously locked by this form without unlocking the other records.

  Are there anyway i can do this without disconnecting or issuing a BeginTrans/RollbackTrans? thanks
0
Comment
Question by:max1978ex
1 Comment
 
LVL 18

Accepted Solution

by:
mdougan earned 50 total points
Comment Utility
I'd have to see your syntax for issuing the select for update statement.

Most people simply open a recordset that is updateable, and then start changing values in a particular record.  If you have set a Lock type of Pessimistic, then it will automatically lock the record.  I think that there is a recordset CancelEdit method you can call to cancel edit mode on the current record.  Under DAO, you explicitly had to say RS.Edit and then RS.Update, but if you wanted to cancel the edit you'd just issue a second RS.Edit statement.

In your case, if you are opening a Recordset for each record that you are "locking" then closing the recordset should cancel any changes you've made, as long as you haven't issued an RS.Update statement, without it being necessary for you to close the connection.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

12 Experts available now in Live!

Get 1:1 Help Now