Subject Re: [IBO] 2-Posting a new record in a Dataset linked to a TIB_Grid
Author Jose Ostos
I Think that Woody is on the right track. When you post the record, the
IB_Query will use the code that is in the "InsertSql" property regardless of
the fields that the query returns. You can check the property with the
object inspector, or you can inspect the property when you are debugging the
"BeforePost" event (using "Run - Evaluate/Modify" and evaluate the the
"IB_QueryConta.InsertSQL" expression.

Jose Ostos


----- Mensaje original -----
De: "Roberto Freitas" <solanofreitas@...>
Para: <IBObjects@yahoogroups.com>
Enviado: Jueves, 15 de Septiembre de 2005 12:23 p.m.
Asunto: Re: [IBO] 2-Posting a new record in a Dataset linked to a TIB_Grid


>I am not filling in the Insert, Update, Delete SQL properties myself
>
> --- In IBObjects@yahoogroups.com, "Woody" <woody-tmw@g...> wrote:
>
>> From: "Roberto Freitas" <solanofreitas@t...>
>> > Hi, Helen
>> > I will try to remake question from the begining, but adding some
> new
>> > informations !-).
>> > I am using a TIB_Grid linked to a TIB_DataSource and a TIB_Query.
>> > I have this code at IB_QueryContaAfterInsert event:
>> > with IB_QueryConta do
>> > begin
>> > ...
>> > FieldByName('cct_ciireg').AsString := Gl_ciireg_f;
>> > ...
>> > end;
>> > Im this case, Gl_ciireg_f = '10010001'
>> > For a new record, the user types values for other fields on the
>> > TIB_Grid. Field cct_ciireg is not visible on the grid, so user
> cannot
>> > change it.
>> > I checked that the code above actually executes.
>> > I watched FieldByName('cct_ciireg').AsString in 2 different
> places:
>> > at end of IB_QueryContaAfterInsert event and
>> > at end of IB_QueryContaBeforePost event
>> > In both places, the value is correct = '10010001'
>> > Although, when posting record, I got this ISC Error Message:
>> > ISC ERROR CODE: 335544347
>> > validation error for column CCT_CIIREG, value "***null***"
>> > If FieldByName('cct_ciireg').AsString = '10010001' just before
> post
>> > record (IB_QueryContaBeforePost event), how can I get this error?
>>
>> Are you filling in the Insert, Update, Delete SQL properties
> yourself or are
>> you letting the IB_Query do it for you at run-time? It looks to me
> like the
>> field may not be part of the insert query so it is therefore being
> seen as
>> NULL on the server.
>>
>> >
>> > P.S.: I am sorry, I know it's my fault, but I dont't understand
> what
>> > it means:
>> > "I suggested rewriting your handler so that it refers to the
>> > IB_Dataset argument of the handler method. I still suggest that."
>>
>> Object methods all have a Sender parameter which is the object
> executing the
>> method. For BeforeInsert and AfterInsert methods, the Dataset
> object that is
>> passed is what you should use in the statements, not the actual
> component
>> name IB_QueryConta.
>>
>> HTH
>>
>> Woody (TMW)
>
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>
>
>
>
>