Subject Re: [IBO] TIB_Query->Insert throws on non-NULL fields - FIXED
Author Jason Wharton
It will either go into edit state or insert state automatically if you
change a field value.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: <support@...>
To: <IBObjects@yahoogroups.com>
Sent: Thursday, January 30, 2003 9:44 AM
Subject: Re: [IBO] TIB_Query->Insert throws on non-NULL fields - FIXED


> > It looks as if your Query is already in Insert/edit mode before
> calling
>
> Bingo - that's it!
>
> I'd changed some code so that it was doing this (on an empty dataset):
>
> qry->FieldByName("Notes")->AsString = "Uh-oh";
> ....
> qry->Insert(); // Pow!
>
> Does the first line auto insert a row? Or should it throw an
> exception?
>
> Anyhow, the correct sequence below works.
>
> qry->Insert();
> qry->FieldByName("Notes")->AsString = "Uh-oh";
>
> That's something new I've learnt.
>
> Thanks for everyone's suggestions.