Subject Re: [IBO] IB_Query - wrong ID assigned
Author malyv2
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 07:55 AM 23/05/2005 +0000, you wrote:
> >I have IB_Query, IB_Grid and IB_UpdateBar.
> >
> >ID_VYKON is a primary key.
> >
> >IB_Query:
> > FieldsReadOnly.Add('ID_VYKON=True');
> > GeneratorLinks.Add('ID_VYKON = GEN_CISVYKONY');
> > KeyLinks.Add('ID_VYKON');
> > KeyLinksAutoDefine := False;
> >1. Insert record - I can see assigned ID_VYKON in grey field -
that's OK
> >2. Refresh just inserted record - I see in column ID_VYKON assigned
> >number +1
> >3. It is ONLY when property FieldsReadOnly is assigned. I don't know
> >why generator fired twice.
> >
> >What is wrong? How I can prevent user editing this field?
>
> Probably you have a Before Insert trigger on this table, to generate
this
> primary key? You need to change this trigger to:
>
> as
> begin
> If (new.ID_VYKON is null) then
> new.ID_VYKON = GEN_ID(GEN_CISVYKONY, 1);
> end
>
> Helen

Helen,
thank for your reply, but it is not solving that problem. I had this
trigger excatly as you wrote. It is maybe a bug.

Vlado