Subject Re: [IBO] Still little problems
Author Lester Caine
> The form works with only one table (no joins) and all the fields are
> required. This is enforced also in the database by means of the
> respective domains (they are all defined as NOT NULL). The REQUIRED
> check box in the TIB_Query.ColumnAttributes for all fields is grayed
> so, AFAIK, IBO should ignore the Required management and let the
> database throw an error if a null field is let in the row.
>
> For this purpose I have written a simple TIB_Query.OnError handler
> containing this code:
>
> RaiseException := False;
> MessageDlg('There is an error'....
>
> but I have left for now TIB_Query.CheckRequired := True.
>
> Well, this handler is never fired when I leave a NULL field and I try
> to post, and another error message is shown (I suppose it is an IBO
> standard error message showing because CheckRequired := True).
>
> But now if I set CheckRequired := False, no errors pop up at all and
> the NULL field is written in the row, even if the field has the "NOT
> NULL" check in the domain.
>
> What am I doing wrong (or forgetting) now? Shouldn't an EIB_Error pop
> up in this case?

Do you have all of the fields in the table configured as
'NOT NULL'? That is - has the table been created with NOT
NULL fields.

If not, then posting NULL values is acceptable, and IBO is
only trying to add an error because the database did not
return one. I believe that the database error is always
returned, just adding the NOT NULL in the query is not the
correct way of doing it, and so perhaps that is a bug?

I still have fun with errors coming back from the database,
but I tend to do this sort of checking in the form before
posting, and then I can say which field has not been
populated, rather than just 'there is a problem'.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services