Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
Is this OK? |
Mon, Aug 31 2020 1:59 AM | Permanent Link |
Ian Branch | Hi Guys,
Is this construct valid/legal as a means of testing if a record is locked and if it is, exiting the procedure? {code} // Try Parts.LockCurrentRecord except MessageBeep(MB_ICONEXCLAMATION); ShowMessage('The Parts record for Part # ' + lblPartNo.Caption + ' is currently in use/locked by another user.' + #13#10 + 'The operation cannot continue!' + #13#10 + 'Please retry later.'); Exit; End; // Parts.UnlockCurrentRecord; // {code} It just seems strange to me. Regards, Ian |
Mon, Aug 31 2020 2:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Ian
Looking at the manual <<Use the LockCurrentRecord method to manually lock the current row. Row locks established via this method are persistent and are maintained across any Edit or Delete calls. You must manually unlock any rows locked using this method via the UnlockCurrentRecord or UnlockAllRecords methods.>> I'd say it depends what you want it for. My interpretation of the manual is that its different to editing a record and won't notify you if another user has the record locked for editing. I'll need to set up a test bed to try that out. I looked at the manual a bit more and found TEDBDataSet.RecordIsLocked Method <<Use this method to determine if the current row has been locked by the LockCurrentRecord method. This method only includes manually-locked rows and will not indicate if a row is locked via the Edit method when the current session's RecordLockProtocol is set to lpPessimistic. Such row locks are considered implicit.>> So if its to see if someone else is editing the record - it won't. Have you thought of {code} // Try Parts.Edit; except MessageBeep(MB_ICONEXCLAMATION); ShowMessage('The Parts record for Part # ' + lblPartNo.Caption + ' is currently in use/locked by another user.' + #13#10 + 'The operation cannot continue!' + #13#10 + 'Please retry later.'); Exit; End; // Parts.Cancel; // {code} Roy Lambert |
Mon, Aug 31 2020 3:03 AM | Permanent Link |
Ian Branch | HI Roy,
I missed that bit about only being relevant for manual locks. Your solution will do the Job admirably. I am even able to eliminate the OnEditError routine I had. Regards & Tks again, Ian |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |