Subject Re: [IBO] DML Caching
Author Helen Borrie
At 01:03 PM 29-08-01 +0000, you wrote:
>Helen
>
>In the simplest dataset I have tried it on, table has a compound
>primary key (both are of type Int64):
>
>PCAT_UNIQUE_REF
>PCAT_SYSTEM_REF

OK


>PCAT_SYSTEM_REF is also a foreign key of another table.

OK


>GeneratorLinks
>PCAT_UNIQUE_REF=NN_PRODCATS

OK


>KeyLinks
>PCAT_UNIQUE_REF
>PCAT_SYSTEM_REF

OK


>OnNewRecord handler:
>With IB_Dataset do
> FieldByName('PCAT_SYSTEM_REF').AsInt64 := MainForm.SystemRef;

Here is where the variant conversion problem is. My guess is that your SystemRef variable is not a variant, right? Try changing the code to ...).AsInteger := ....
or, failing that ...).Value := ....

Also,

>There is a trigger on PRODCATS before insert:
>IF (NEW.PCAT_UNIQUE_REF IS NULL) THEN
> NEW.PCAT_UNIQUE_REF = GEN_ID(NN_PRODCATS, 1);

That's OK too; although it won't be fired for your application inserts because GeneratorLinks fetches the generator value for you. It's a good safeguard in case someone is working with the data interactively.

Cheers,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________