Solved

Unlock records

Posted on 2002-04-18
1
928 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 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…

729 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