Re:transaction lock
Hi Todd,
many thanks for answering.
here's is more exact example.
database part
=========================
table1 has columns.
ID, INVOICE_NUMBER, AMOUNT
primary key = ID, unique = INVOICE_NUMBER
table2 hasd columns
ID, TABLE1_INVOICE_NUMBER, OTHER_FIELDS
primary key = ID, foreign key = TABLE1_INVOICE_NUMBER points to table1
INVOICE_NUMBER.
=========================
application part
=========================
IBqry1->SQL->Text="select * from table1 where INVOICE_NUMBER=:MYNUMBER";
Generator Field = on server by 1 table1_gen.
IBqry2->SQL->Text="select * from table2 where
TABLE1_INVOICE_NUMBER=:MYNUMBER";
IBqry1->Params->Item[0]->AsString=Edit1->Text;
IBqry2->Params->Item[0]->AsString=Edit1->Text;
IBqry1->Open();
//ERROR only appears if I have another instance of program open, and try to
write to the same table.
if(IBqry1->IsEmpty())
{
//HERE I HAVE A PROBLEM WHEN I POST();
IBqry1->Insert();
IBqry1->FieldByName("INVOICE_NUMBER")->AsString=Edit->Text;
IBqry1->Post();
//error: EIBInterBaseError with message 'lock conflict on no wait
transaction deadlock'.
IBqry1->Edit();
}
else
{
//HERE I HAVE NO PROBLEM AT ALL, IF RECORD ALREADY EXISTED THEN IT ALL GOES
FINE.
IBqry1->Edit();
}
IBqry2->Open();
this is how I open database (more or less)...
then when I save the database (by the way it's not in CachedUpdates mode,
it's in normal mode).
so when the record already existed it works fine.
but if I open one record in program.
then I start program on another computer, or run another instance of
program.
and try to insert into the same table, but ofcourse different number of
INVOICE_NUMBER in table1,
I get this error: EIBInterBaseError with message 'lock conflict on no wait
transaction deadlock'.
=========================
sorry the post came up to be quite big.
but I'd really appreciate someone helping me.
many thanks...