Detecting record lock in Paradox Table

Posted on 1998-11-30
Last Modified: 2010-04-04
I am writing an multi-tier application using Delphi3 C/S version.  Is there any way I can detect from client A if a record has been locked due to editing by any other clients ?
Question by:ray3898
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

Expert Comment

ID: 1348702
How about this:

Write a function that accepts the TDataSet name as a parameter and will return a TRUE value if the record is locked.

Then try and place the dataset in edit mode within a try except error handler. You could analyse the error in more detail to trap specifically for a situation where the record is locked. This function will however tell you if it is possible the allow the edit or not.


function IsLocked(TheDataSet: TDataSet): Boolean;
   Result := False;
      Result := True;

LVL 27

Expert Comment

ID: 1348703
hi ray3898,

a other method

procedure TForm1.Button1Click(Sender: TObject); {Or other EventMethod}
var IsLocked : Bool;
 if dbiisrecordlocked(table1.handle,IsLocked) = DBIERR_NONE then
   if IsLocked then showmessage ('Record Locked');

This requires the unit BDE in the uses clause of your unit.


Author Comment

ID: 1348704
It seems to me that your method is reside on the client side rather than the application side (back-end).  Since both client A and client B would receive a copy of the actual data (table1.db) from the application server, so all locking are taken place on the local copy but not on the actual table (am I right ?)  Therefore, what I want is when client A want to edit a record, the program will check directly from the application server to determine the current status of the record. Is it possible to do it and how can I do it ?

Thank you

Accepted Solution

Ronald Buster earned 50 total points
ID: 1348705
I used to have the same problem, use the following statement,
just a code snippet from one of my sources


  ... whatever you want to do


   on E: EDBEngineError do


           ... record is proberly locked





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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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