ClientDataSet and serial fields
Posted: Mon 16 Feb 2009 22:49
Hi,
I'm using a PgQuery -> DataSetProvider -> ClientDataSet -> PgDataSource "chain" to manage the data.
It's all ok, but...
If I have a table with a field (the primary key) defined as serial data type (and in the query properties the key and the sequence name are correctly defined), the first record you insert is ok (and it takes, for example, the id value of 1), but when you post a second one you receive an error message of "duplicate key" or similar instead of the id 2.
On every post I call a StartTransaction, ApplyUpdates(0), Commit.
If I use only PgQuery -> PgDataSource is all ok.
Is there something I'm doing wrong?
Thanks in advance.
Sergio
I'm using a PgQuery -> DataSetProvider -> ClientDataSet -> PgDataSource "chain" to manage the data.
It's all ok, but...
If I have a table with a field (the primary key) defined as serial data type (and in the query properties the key and the sequence name are correctly defined), the first record you insert is ok (and it takes, for example, the id value of 1), but when you post a second one you receive an error message of "duplicate key" or similar instead of the id 2.
On every post I call a StartTransaction, ApplyUpdates(0), Commit.
If I use only PgQuery -> PgDataSource is all ok.
Is there something I'm doing wrong?
Thanks in advance.
Sergio