Subject | Re: [IBO] 2-Posting a new record in a Dataset linked to a TIB_Grid |
---|---|
Author | Roberto Freitas |
Post date | 2005-09-15T17:23:57Z |
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)