Subject [IBO] Re: Object in use when dropping table
Author bobzirbel@yahoo.com
Thanks for your reply Russell. I'll try your suggestion.

I do need to drop the table because it's structure potentially
changes every time it is created.

Thanks and regards

Bob

--- In IBObjects@y..., "Russell Belding" <russell@b...> wrote:
> Hello Bob
>
> Using a TIBOuery I guess you are using the default transaction.
Without
> reading about it I do not know its behaviour. So you could try not
using it
> and use an explicit transaction whose behaviour you control.
>
> If the problem is the Default transaction is still active and the
table you
> want to drop is sTable, and it is in use by the Default transaction
at the
> point you want to drop it, then try this:
>
> 1. Place a TIB_transaction on your form and set the
TIBOQuery.IB_Transaction
> to this transaction.
> If there are other parts to your transaction also have them use the
new
> transaction; take them off the Default transaction.
> 2. Explicitly start the transaction, at the appropirate place.
(Read about
> transactions in the Getting Started Guide and several other places.)
> 3. Explicity commit the transaction and close it when one unit of
work is
> done.
> 31. Try to drop your table now.
> 4. Restart the transaction for the next unit of work.
>
> All this assumes the "Object in use" error is valid, and the
problem is as
> suggested above.
>
> Do you need to drop the table? Could you empty it and reuse it?
>
> Regards
>
> Russell
>
>
>
> ----- Original Message -----
> From: <bobzirbel@y...>
> To: <IBObjects@y...>
> Sent: Wednesday, July 25, 2001 4:46 PM
> Subject: [IBO] Re: Object in use when dropping table
>
>
> > Thanks for your reply Russell.
> >
> > The problem is caused by the following code:
> > with ReportQuery do begin (TIBOQuery, ResultLive := False)
> > Close;
> > SQL.Clear;
> > SQL.Add('Select * from ' + sTable);
> > Open;
> > // Report code removed
> > Close;
> > end;
> >
> > There is no error if this code is removed. It's as if
the 'Close' is
> > being ignored!
> >
> > Regards
> >
> > Bob
> >
> > --- In IBObjects@y..., "Russell Belding" <russell@b...> wrote:
> > > Hello Bob
> > >
> > > If, when you try to drop the temporary table, there is a
> > transaction open
> > > which uses the table then the "Table is in use". Could this be
the
> > problem?
> > > Without your code I cannot fully understand your logic in steps
> > 1...6.
> > >
> > > Regards
> > >
> > > Russell Belding
> > >
> > >
> > > ----- Original Message -----
> > > From: <bobzirbel@y...>
> > > To: <IBObjects@y...>
> > > Sent: Wednesday, July 25, 2001 2:51 PM
> > > Subject: [IBO] Object in use when dropping table
> > >
> > >
> > > > I have some code that uses TIB_grid, TIB_Query and TIBOQuery
with
> > D5
> > > > and IB6.
> > > > The code drops and creates a temporary table, populates the
table
> > > > from records selected in the grid, opens a simple query on the
> > > > temporary table and prints a report.
> > > >
> > > > All works fine - once! The second time the code is executed
it
> > > > errors with 'Object in use' on the drop table.
> > > >
> > > > I have eliminated all extraneous code and narrowed the cause
down
> > to
> > > > the last query. It's close doesn't seem to free the temporary
> > > > table. The sequence is as follows:
> > > >
> > > > 1. Drop table.
> > > > 2. Create table.
> > > > 3. Populate table.
> > > > 4. Select * from table.
> > > > 5. Open.
> > > > 6. Close.
> > > > 1. Drop table - error Object in use!
> > > >
> > > > If steps 4, 5 & 6 are eliminated it works fine.
> > > >
> > > > Does anyone have any idea what I doing wrong?
> > > >
> > > > Any help would be appreciated.
> > > >
> > > > Thanks and regards
> > > > Bob
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >