Insert into

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ibdac2pro
Posts: 17
Joined: Mon 15 Oct 2007 14:26
Location: UK

Insert into

Post by ibdac2pro » Mon 11 Feb 2008 14:48

Hi i'm new to SQL.
I have a problem with insert into.
I have simplified the problem as follows

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with query1 do
begin
text:='INSERT INTO TEST3 ( NAME) VALUES (:NAME)';
query1.Prepare;
query1.Params[0].AsString:=edit1.Text;
query1.Execute;
query1.unPrepare;
end;
ibctable1.Refresh;
end;

Query1 is an IBCSQL1


Why can I get the table to show records being entered. But after you close the app, the table is empty.

TEST3 uses a gen field in interbase for TEST_NO (Not Shown)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 12 Feb 2008 15:17

You do not commit changes made to the table. To do this:
- set AutoCommit property in all components you use (TIBCConnection, TIBCSQL) to True;
- or call TIBCSQL.Transaction.CommitRetaining after TIBCSQL.Execute to make all changes to the table permanent and retain data in TIBCTable component.

Post Reply