Subject Re: Object in use
Author Svein Erling Tysvær
I always close the query before committing the transaction, not the other way
around. Moreover, I never start a transaction explicitly, I just commit and let
Jason decide when to start the transactions.

I assume you are certain that no-one else is using the table in question
(including backup, foreign keys and possibly triggers)? Are anyone else
connected to the database at all?

HTH,
Set

--- In IBObjects@yahoogroups.com, "Riho-Rene Ellermaa" wrote:
> Query->SQL->Clear();
> Query->SQL->Add("select * from for_corresp for update");//notr
> Query->Open();
> while(!Query->Eof)
> { String S1=Query->FieldByName("baddress")->AsString;
> if(S1.Length()>70)
> { S1.SetLength(70);
> Query->Edit();
> Query->FieldByName("baddress")->AsString=S1;
> Query->Post();
> }
> Query->Next();
> }
> Trans->Commit();
> Query->Close();
>
> Trans->StartTransaction();
> Query->SQL->Clear();
> //this block is just to get rid rid of object in use message
> Query->SQL->Add("select * from for_pay for update");//notr
> Query->Open();
> Query->Close();
> Trans->Commit();
>
> MyScript->Execute();
> //In this script I want to drop FOR_CORRESP table
>
> How can I stop the FOR_CORRESP to being in use?
>
> For a moment I solved the problem by closing and opening database
> connection.