Subject Re: [IBO] Posting a new record in a Dataset linked to a TIB_Grid
Author Helen Borrie
At 05:41 PM 15/09/2005 +0200, you wrote:
>Hi Roberto,
> > 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?
>you should use the BeforeInsert event to assign values to your
>fields. The AfterInsert event occurs _after_ the record has been
>inserted on the server.

No, this is not correct. Nothing gets posted to the server until Post is
called. AfterInsert happens immediately after the dataset goes into dssInsert.

BeforeInsert, on the other hand, occurs *before* the dataset goes into
dssInsert. Therefore, at that point, the dataset is looking at the current
row in the buffer, not at a new, empty buffer row.

I suggested rewriting your handler so that it refers to the IB_Dataset
argument of the handler method. I still suggest that.

Alternatively, you could use the BeforePost event. But, when using event
handlers, be sure to refer to the method's arguments.

>And, if this is a default value, you should consider to set the
>default value in the field attributes of your IB_Query.