Lazarus

Programming => Databases => Topic started by: abmservice on August 14, 2009, 10:36:41 pm

Title: INSERT IBconnection+transaction+SQLquery+Datasource+dbedit
Post by: abmservice on August 14, 2009, 10:36:41 pm
LAZARUS 0.9.27
FIREBIRD 2.1
WINDOWS XP

IBconnectoin(SQLdb)
sqltransactoin
sqlquery
datasource
dbedit

INSERT

begin
sqlquery.post;
sqlquery.applyupdates;
sqltransaction.commit;
end;
After adding a record to a database other components connected to SQLQuery IBconnectoin be disconnected. Why? What's wrong?

Title: Re: INSERT IBconnection+transaction+SQLquery+Datasource+dbedit
Post by: clauslack on August 19, 2009, 01:49:52 am

Maybe when you commit an insert, after you must do a select in a new transaction.

You can try this example for select-insert with Firebird.
Change in FormCreate the parameter for you Firebird database.

Upload sql_example.zip
Tested under
- Windows XP SP3 and Linux
- Lazarus 0.9.27 svn 21289 fpc 2.3.1 svn 13383/fpc 2.2.4.
- Firebird 2.1.2


Regards
Title: Re: INSERT IBconnection+transaction+SQLquery+Datasource+dbedit
Post by: Loesje on August 25, 2009, 06:21:30 pm
.Commit commits and closes the transaction. All other datasets/things within the same connection are also closed. You need .CommitRetaining which keeps the connection open.
TinyPortal © 2005-2018