Subject RE: [firebird-support] Re: Copy records - solved
Author Helen Borrie
At 05:01 PM 5/08/2004 +0200, you wrote:
> > >>Violation of PRIMARY or UNIQUE KEY constraints "INTEG_94" on table
> > >>"MATCONTI"
>
>
>I've got it working now!
>I have never worked with ExecSQL before...
>
>Normaly I use folowing:
>- close dataset
>- prepare sql
>- open dataset
>
>So I did it here:
>- close dataset
>- prepare sql
>- open dataset
>- call ExecSQL
>
>sql statement executed twice.
>
>Is this so, that ExecSQL does not need opened dataset ?

You open and close datasets. Only SELECT statements have datasets. When
you are going to submit any other sort of statement, you don't open
anything, you just test that it is prepared, prepare it if required, and
execute it:

{Sans exception handling, it's bedtime}

with transaction do
b
if not inTransaction then
StartTransaction;
e
with statement do
b
if not Prepared then Prepare;
ExecSQL;
e
.....

transaction.Commit;

/hb