Subject Re: [IBO] TIB_Query->Insert throws on non-NULL fields
Author Paul Vinkenoog
Hi Lester,

> > This used to work and I'm fairly sure I haven't changed any of the
> > TIB_Query properties.
> >
> > Using the default TIB_Query properties, I call:
> >
> > qry->Insert();
> >
> > IBO throws an exception warning me that:
> >
> > "myfieldname is a required field"
> >
> > Tracing into Insert() it goes into SysInsert, SysPost and finally
> > CheckRequiredFields where the exception is thrown.

(...)

> The problem is in the database. One of the fields you are
> not filling in the Insert is expecting a non-NULL value. You
> need to find out which one it is and put someting into it
> before the insert.

But Insert() as such only makes a new row at the client side, it
doesn't send anything to the server. Thse usual sequence is:

qry->Insert();
qry->FieldByName("ThisRequiredField")->AsInteger = 666;
qry->FieldByname("ThatRequiredField")->AsString = "Beast";
qry->FieldByname("SomeOtherField" )->AsDateTime = Now();
...
...
qry->Post();

Before the call to Insert() there are no new fields to fill in.
David problem seems to be that for this particular query, Insert()
leads to a call chain that includes SysPost().


Greetings,
Paul Vinkenoog