Solved

Unlock records

Posted on 2002-04-18
1
927 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

749 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