Solved

Unlock records

Posted on 2002-04-18
1
923 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
ID: 6950716
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

911 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

20 Experts available now in Live!

Get 1:1 Help Now