TZTable tries to set Identity column on insert
Posted: 12.04.2017, 06:50
Hi,
I created simple application in Delphi - TZConnection, TZTable, TDataSource, TDBGrid.
Also created a table in FireBird with identity column
create table Perspective (
Id integer generated by default as identity primary key,
Name varchar(64)
);
When I run the application and type value for Name in the DBGrid,
and press down arrow button to insert the record, it throws an exception:
'Project ZeosTest raised exception class EZSQLException with message'SQL Error: validation error for column "PERSPECTIVE"."ID" value "***null***".
Error code - 625. Insert failed because a column definition includes validation constraints.
The SQL: INSERT INTO PERSPECTIVE (ID, NAME) VALUES (?, ?);'.
I tried to solve the problem by:
1. adding all fields in the TZTable
2. setting property 'AutoGenerateValue' to arAutoInc in the TZTable
3. setting property 'Required' to False in the TZTable
This application is very basic and a lot of people starts using components and database this way.
Also using simple table is used very often.
So, I expected this to work out of the box, just by connecting the components and to go smooth.
Can you give me some more information and may be some solution to this issue?
I'm using
Zeos 7.2.1-rc
Firebird-3.0.2.32703-0_Win32
Delphi XE3
Thanks
Daniel
I created simple application in Delphi - TZConnection, TZTable, TDataSource, TDBGrid.
Also created a table in FireBird with identity column
create table Perspective (
Id integer generated by default as identity primary key,
Name varchar(64)
);
When I run the application and type value for Name in the DBGrid,
and press down arrow button to insert the record, it throws an exception:
'Project ZeosTest raised exception class EZSQLException with message'SQL Error: validation error for column "PERSPECTIVE"."ID" value "***null***".
Error code - 625. Insert failed because a column definition includes validation constraints.
The SQL: INSERT INTO PERSPECTIVE (ID, NAME) VALUES (?, ?);'.
I tried to solve the problem by:
1. adding all fields in the TZTable
2. setting property 'AutoGenerateValue' to arAutoInc in the TZTable
3. setting property 'Required' to False in the TZTable
This application is very basic and a lot of people starts using components and database this way.
Also using simple table is used very often.
So, I expected this to work out of the box, just by connecting the components and to go smooth.
Can you give me some more information and may be some solution to this issue?
I'm using
Zeos 7.2.1-rc
Firebird-3.0.2.32703-0_Win32
Delphi XE3
Thanks
Daniel