Subject Re: [IBO] Re: Preparing a TIB_Query throws a 'COL is a required field" error
Author Jason Wharton
Apparently it is already in insert mode.

Unlike TIBOQuery, TIB_Query allows records to be inserted without opening
the query.

Jason Wharton

----- Original Message -----
From: "tickerboo2002" <egroup@...>
To: <IBObjects@yahoogroups.com>
Sent: Friday, November 06, 2009 7:03 AM
Subject: [IBO] Re: Preparing a TIB_Query throws a 'COL is a required field"
error


> What I posted was not quite correct. My code actually looks like this:
>
> qryAddCall->Prepare();
> sTrace += "b";
> qryAddCall->Insert();
> sTrace += "c";
>
> and the code at the customer site throws the exception when Insert is
> called. Why does it warn about the 'required field' column there and not
> when the data is posted?
>
>
>
> --- In IBObjects@yahoogroups.com, "tickerboo2002" <egroup@...> wrote:
>>
>> Using IBO v4.8.7 with BCB2006 and I'm experiencing a weird problem at a
>> customer site (works fine for me). Here's the ghist of my code:
>>
>>
>>
>> if ( CallWasPreviouslySaved )
>> {
>> qryAddCall->Prepare();
>> qryAddCall->ParamByName("CALL_ID")->AsInteger = pCall->CallID_DB;
>> qryAddCall->Open();
>> }
>> else
>> {
>> qryAddCall->Prepare(); <-----
>> qryAddCall->Insert();
>> }
>>
>> I'm using prepared edits/inserts and when I call Prepare (prior to
>> Insert) I get an exception being thrown 'CONTACT_ID is a required field'.
>> The CONTACT_ID column is a not NULL column of the table.
>>
>> Whenever I test this here, it works with no issues. However, on a
>> customer site, they always get the exception being thrown when 'Prepare'
>> is called. I can imagine this error being thrown when I go to
>> Post/Commit data, but not when performing a Prepare.
>>
>> Can anyone cast any light on why/how this could be happening and are
>> there any properties of the TIB_Query that could be causing this?
>>
>> Many thanks.