Subject | After Committed Autoincrement Field Value Not Updated In DBGrid |
---|---|
Author | Rio Hermawan |
Post date | 2008-10-12T17:13:04Z |
I'm using Firebird 2.1 and do the coding with Delphi 7.
In Firebird :
- Table with these fields :
Urut -> Not Null -> Unique
Nama -> Not Null -> Primary
- Generator : GEN_IC_MASTER
- Trigger : AS
BEGIN
IF (NEW.URUT IS NULL) THEN
NEW.URUT = GEN_ID(GEN_IC_MASTER,1);
END
In data module :
- IBDatabase
- IBSQL which CachedUpdates set to true, GeneratorField set to
gen_ic_master -> Urut By 1 with ApplyEvent set to On Server
- IBUpdateObject
In form :
- Dbgrid,
- Dbnavigator
- Dbedit for handling field Nama
when I insert or append a new record in my form then have the update
applied and commited, the field Urut value in dbgrid remain empty.
After I close then reopened the file, the field Urut value is shown
correctly.
If I don't close and then reopened the file and insert a new record
in another table which depend on field Urut as foreign key, a error
occured, said that field Urut has to have a value ?
Anybody can help ? Thanks
In Firebird :
- Table with these fields :
Urut -> Not Null -> Unique
Nama -> Not Null -> Primary
- Generator : GEN_IC_MASTER
- Trigger : AS
BEGIN
IF (NEW.URUT IS NULL) THEN
NEW.URUT = GEN_ID(GEN_IC_MASTER,1);
END
In data module :
- IBDatabase
- IBSQL which CachedUpdates set to true, GeneratorField set to
gen_ic_master -> Urut By 1 with ApplyEvent set to On Server
- IBUpdateObject
In form :
- Dbgrid,
- Dbnavigator
- Dbedit for handling field Nama
when I insert or append a new record in my form then have the update
applied and commited, the field Urut value in dbgrid remain empty.
After I close then reopened the file, the field Urut value is shown
correctly.
If I don't close and then reopened the file and insert a new record
in another table which depend on field Urut as foreign key, a error
occured, said that field Urut has to have a value ?
Anybody can help ? Thanks