Subject Re: Generator Links at runtime
Author txwhytboy
I went with the DSQL way (since I'm only doing the insert once),
however, when it runs the GEN_ID line.. It comes back saying 'Unable
to get generator value'.

I'm sure this has been seen before... What might be causeing this?

- Roger



> However, it's not really the right thing to do, to create an
IB_Query on
> the fly for the sole purpose of inserting a row. Since you don't
need a
> dataset, with all of its overhead, you should create an IB_DSQL and
fire
> your insert off that:
>
> var
> Table1ID: integer;
> begin
> IB_DSQL1 := TIB_DSQL.Create(self);
> with IB_DSQL1 do
> try
> IB_Connection := My_IB_Connection;
> TABLE1ID := Gen_ID('gen_Table1_PK',1);
> SQL.Add('Insert into TABLE1 (');
> SQL.Add('Table1_PK, ColA, ColB)');
> SQL.Add('Values(TABLE1ID, :ColA, :ColB);
> Prepare;
> Params['ColA'].AsWhatever := SomeValue;
> Params['ColB'].AsWhatever := SomeOtherValue;
> Execute;
> ...
> finally
> Free;
> end;
> end;
>