Subject | Posting a second record to a Dataset linked to a TIB_Grid |
---|---|
Author | Roberto Freitas |
Post date | 2005-10-04T18:26:56Z |
Hi Helen,
Now I remember my original problem that persists for weeks and was
posted before.
Take a look on my original question:
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***"
Looking at TIB_Monitor, the real Insert statement doesn't have field
cct_ciireg, but only fields that are on the TIB_Grid (cct_ciireg is
one of the fields whose value is assigned on code, not on grid,
because it is in the Query but not in the grid):
These are the strings from TIB_Monitor:
INSERT INTO CONTA
( CCT_CONTA
, CCT_TITULO
, CCT_TIPO
, CCT_CUSCOD
, CCT_ORDEM
, CCT_RATEIO)
VALUES
( ? /* CONTA.CCT_CONTA */
, ? /* CONTA.CCT_TITULO */
, ? /* CONTA.CCT_TIPO */
, ? /* CONTA.CCT_CUSCOD */
, ? /* CONTA.CCT_ORDEM */
, ? /* CONTA.CCT_RATEIO */ )
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
----*/
/*---
[ 16/09/2005 07:02:11 ]
EXECUTE STATEMENT
TR_HANDLE = 14164468
STMT_HANDLE = 14166400
PARAMS = [ Version 1 SQLd 6 SQLn 6
CONTA.CCT_CONTA = '110103018'
CONTA.CCT_TITULO = 'teste'
CONTA.CCT_TIPO = 'A'
CONTA.CCT_CUSCOD = 'teste'
CONTA.CCT_ORDEM = 0
CONTA.CCT_RATEIO = 0 ]
ERRCODE = 335544347
----*/
/*---
[ 16/09/2005 07:02:11 ]
INTERPRET BUFFER =
ERRCODE = 60
----*/
/*---
[ 16/09/2005 07:02:11 ]
INTERPRET BUFFER = validation error for column CCT_CIIREG, value "***
null ***"
Submiting these questions on Forum before, somebody suggests to fill
in the IB_Query Insert property (at end of BeforePost event) with the
statement I want to submit to the server.
Following this track I got no more that database **null** error but I
could not insert a second record because grid turned to a kind of
Read_Only state.
So I still have the problem:
- if I dont fill in the IB_Query Insert property (at end of
BeforePost event) with the statement I want to submit to the server I
get the **null** error because InsertSQL statement automatically
created by IBO doesn't contains all necessary fields
- if I fill in the IB_Query Insert property, record IS POSTED (as I
can see with IBOConsole) but I get a new problem: cannot insert a
second record because grid turned to a kind of Read_Only state.
I really need a help to understand and fix this stuff!
Now I remember my original problem that persists for weeks and was
posted before.
Take a look on my original question:
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***"
Looking at TIB_Monitor, the real Insert statement doesn't have field
cct_ciireg, but only fields that are on the TIB_Grid (cct_ciireg is
one of the fields whose value is assigned on code, not on grid,
because it is in the Query but not in the grid):
These are the strings from TIB_Monitor:
INSERT INTO CONTA
( CCT_CONTA
, CCT_TITULO
, CCT_TIPO
, CCT_CUSCOD
, CCT_ORDEM
, CCT_RATEIO)
VALUES
( ? /* CONTA.CCT_CONTA */
, ? /* CONTA.CCT_TITULO */
, ? /* CONTA.CCT_TIPO */
, ? /* CONTA.CCT_CUSCOD */
, ? /* CONTA.CCT_ORDEM */
, ? /* CONTA.CCT_RATEIO */ )
FIELDS = [ Version 1 SQLd 0 SQLn 30 ]
----*/
/*---
[ 16/09/2005 07:02:11 ]
EXECUTE STATEMENT
TR_HANDLE = 14164468
STMT_HANDLE = 14166400
PARAMS = [ Version 1 SQLd 6 SQLn 6
CONTA.CCT_CONTA = '110103018'
CONTA.CCT_TITULO = 'teste'
CONTA.CCT_TIPO = 'A'
CONTA.CCT_CUSCOD = 'teste'
CONTA.CCT_ORDEM = 0
CONTA.CCT_RATEIO = 0 ]
ERRCODE = 335544347
----*/
/*---
[ 16/09/2005 07:02:11 ]
INTERPRET BUFFER =
ERRCODE = 60
----*/
/*---
[ 16/09/2005 07:02:11 ]
INTERPRET BUFFER = validation error for column CCT_CIIREG, value "***
null ***"
Submiting these questions on Forum before, somebody suggests to fill
in the IB_Query Insert property (at end of BeforePost event) with the
statement I want to submit to the server.
Following this track I got no more that database **null** error but I
could not insert a second record because grid turned to a kind of
Read_Only state.
So I still have the problem:
- if I dont fill in the IB_Query Insert property (at end of
BeforePost event) with the statement I want to submit to the server I
get the **null** error because InsertSQL statement automatically
created by IBO doesn't contains all necessary fields
- if I fill in the IB_Query Insert property, record IS POSTED (as I
can see with IBOConsole) but I get a new problem: cannot insert a
second record because grid turned to a kind of Read_Only state.
I really need a help to understand and fix this stuff!