Inserting records with ODAC

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Maur1zz10

Inserting records with ODAC

Post by Maur1zz10 » Sun 17 Apr 2005 22:19

I have some troubles with odac, I really think that the problem is found in the sql statment, I've searching on the web but I haven't found any example that it has the sql statments written like I want, I have moved the apostrophes for everywhere, it always has an exception.

Luckly someone can help me. : :shock:


TFMiAgenda is a TForm.
DMBDOracle is a TOraSession.
OQMiAgenda is a OraQuery.

This is the source code.

procedure TFMiAgenda.Button1Click(Sender: TObject);
begin
DMBDOracle.OQMiAgenda.CachedUpdates:=true;
DMBDOracle.OQMiAgenda.SQLInsert.Text:='insert into miagenda([Nombre],[Direccion],[Telefono],[Fecha]) values(''miNombre'',''miDireccion'',''numTelefonico'',TO_DATE(''15/08/1984'',''dd/mm/yyyy''))';
try
DMBDOracle.OQMiAgenda.Open;
DMBDOracle.OQMiAgenda.Edit;
DMBDOracle.OQMiAgenda.Insert;
DMBDOracle.OQMiAgenda.Post;
DMBDOracle.OQMiAgenda.Session.StartTransaction;
DMBDOracle.OQMiAgenda.Session.Commit;
DMBDOracle.OQMiAgenda.CommitUpdates;
except
on e:Exception do
ShowMessage('ERROR');
end;
FMiAgenda.Refresh;
end;

Thank's.

Maur1zz10

Post by Maur1zz10 » Sun 17 Apr 2005 22:23

By the way, any field is not null.

Maur1zz10

Post by Maur1zz10 » Mon 18 Apr 2005 03:25

The exception is launched on
DMBDOracle.OQMiAgenda.Edit;

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 19 Apr 2005 11:08

Please don't duplicate your posts in two languages, we accept English topics only.
I think that your problem is in quotation symbols [ in your SQL, pls. try to
use " instead of [ .

Post Reply