Subject | RE: [IBO] Re: Receiving an Object In Use error when adding an index to a table |
---|---|
Author | Jeff Gaiche |
Post date | 2009-05-07T13:19:56Z |
Hi Luis...I appreciate your suggestion to do a commit on table1. In this example...that would be easy to do and definitely resolves the problem. In our real world application...unfortunately its not that easy. I was under the impression that for table1...unless I had explicitly started a transaction, IBO would have started one implicitly (like you explained) and then commit the work. In this case...it seems that it hasn't committed the work....yet. Is there some other way to tell TIBODatabase to commit transactions that it has implicitly started ? I thought that either Unprepare or FreeServerResources might cause this to happen...but...that does not seem to be working in this case. Any thoughts ?
Thanks -- Jeff Gaiche
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
Behalf Of Luis Semedo Duarte
Sent: Wednesday, May 06, 2009 5:23 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: Receiving an Object In Use error when adding an index
to a table
Transactions are created implicitly for every command you send to the database.
After posting the record on Table1 try to commit the transaction. Because you never commited the transaction, the server will not allow you to do shanges on the underlying table until any transactions are commited or rolledback.
Table1.IB_Transaction.Commit;
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more ! Yahoo! Groups Links
Thanks -- Jeff Gaiche
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
Behalf Of Luis Semedo Duarte
Sent: Wednesday, May 06, 2009 5:23 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] Re: Receiving an Object In Use error when adding an index
to a table
Transactions are created implicitly for every command you send to the database.
After posting the record on Table1 try to commit the transaction. Because you never commited the transaction, the server will not allow you to do shanges on the underlying table until any transactions are commited or rolledback.
> db:=TIBODatabase.Create(nil);try this
> db.DatabaseName:='C:\dbs\ne\MIS2000.fdb';
> db.Username:='myuser';
> db.Password:='mypassword';
> try
> table1:=TIBOTable.Create(nil);
> table1.IB_Connection:=db;
> table1.TableName:='COESTUD_D';
> table1.Open;
> Table1.Insert;
> Table1.Fields[0].AsInteger:=1;
> Table1.Fields[1].AsInteger:=2;
> Table1.Post;
Table1.IB_Transaction.Commit;
> Table1.Close;cheers
> finally table1.Free end;
>
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more ! Yahoo! Groups Links