Subject | Re: Generator Links at runtime |
---|---|
Author | txwhytboy |
Post date | 2002-07-06T16:03:14Z |
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, 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 anIB_Query on
> the fly for the sole purpose of inserting a row. Since you don'tneed a
> dataset, with all of its overhead, you should create an IB_DSQL andfire
> 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;
>