Subject RE: [IBO] Record not located to update????
Author Dion Oliphant
Hi All,

I have 2 apps running. One of these has a record posted, but not committed.
I try to edit this record in the second app, but have the following problem

The transactions Isolation is tiCommitted.

A transaction is explicity started in the datasource's OnStateChanged event.

if (Assigned(ADataset)) and (ADataset.State in [dssEdit, dssInsert]) then
{ Start the Transaction. }
if not ADataset.IB_Transaction.InTransaction then
ADataset.IB_Transaction.StartTransaction;

I have a TIB_Edit Linked to the above TIB_Datasource.
The record is edited with this component.

I have a TIB_UpdateBar connected to the TIB_Datasource,
and TIB_TransactionBar connected to a TIB_Transaction component.

The OnError event for the TIB_Query i the following:-

with dmPupil do
begin
{ Display the appropriate error message on the bar. }
if ERRCODE = ecLockConflictNoWait then
begin
{ Record is being edited by someone else. }
ilPupil16.Draw(PupilForm.StatusBar1.Canvas, 1, 1, 2);
PupilForm.StatusBar1.Canvas.TextOut(20, 3, '[DEADLOCK]: User ... on
station ... is editing this record');
end

else if ERRCODE = ecForeignKeyViolation then
begin
{ The Grade has Class dependents. }
ilPupil16.Draw(PupilForm.StatusBar1.Canvas, 1, 1, 2);
PupilForm.StatusBar1.Canvas.TextOut(20, 3, 'Delete dependent Classes
first...');
end;

{ Automatically undo all changes done. }
if Sender is TIB_Query then
if TIB_Query(Sender).IB_Transaction.InTransaction then
TIB_Query(Sender).IB_Transaction.RollBack;

If the post is successful, I commit in the AfterPost event of the
TIB_Query:-

if IB_Dataset.IB_Transaction.InTransaction then
IB_Dataset.IB_Transaction.Commit;

If I set RaiseException to false, I get a 'Record not located to be
updated'.
If I set it to true, I get the 'Lock conflict on ...' error. ???

I dont want the user to see the default error...

Thanks,
Dion


-----Original Message-----
From: Dion Oliphant [mailto:dion@...]
Sent: 16 January 2001 09:40
To: IBObjects@egroups.com
Subject: [IBO] Record not located to update????


Hi All,

Has anybody found the solution? I am currently installing the latest version
of IBO. I get this error when posting to an IB_Grid.

Thanks,
D.