Subject Re: [IBO] Posting a new record in a Dataset linked to a TIB_Grid
Author Helen Borrie
At 10:19 AM 15/09/2005 +0000, you wrote:
>I am using a TIB_Grid linked to a TIB_DataSource and a TIB_Query.
>I have this code at IB_QueryContaAfterInsert event:
> FieldByName('REGH').AsString := '10010001';
>For a new record, the user types values for other fields on the
>TIB_Grid. Field REGH is not visible on the grid, so user cannot change
>it. When posting record, I got this ISC Error Message:
> ISC ERROR CODE: 335544347
> validation error for column REGH, value "***null***"
>How can it happens, since the field was assigned to '10010001' at
>AfterInsert event?

Notice the argument ((IB_Dataset: TIB_Dataset)

procedure TdmMyDm.IB_QueryContaAfterInsert(IB_Dataset: TIB_Dataset);
IB_Dataset.FieldByName('REGH').AsString := '10010001';

Note also that, if all inserts are to receive the same value, you can set
that value as a default in the Fields Attributes.