Board index » delphi » AutoIncrement with TTable

AutoIncrement with TTable

My app uses TTable (a long story), to perform inserts, edits etc on a
dataset. I'd like to have an identity, or some kind of auto increment colum,
in a table but, when I pass the data to the other columns (using SetData) I
get an error on passing a null value into the ID column. Can anyone help?
 

Re:AutoIncrement with TTable


You could try the following:

I'm assuming you've made persistent fields for all the fields in the
dataset....

1. Delete the persistent field currently assigned to your autoincrementing
datasetfield.
2. Make a new field, give it the same name as the one you've just deleted
and give it
    type AutoInc.

This could work, depending on the DBMS.

A much safer way, wich is also garanteed to work, is writing a stored
procedure wich will do the AutoInc for you.

Delphi Guru

Quote
"news" <n...@news.com> wrote in message

news:8ivlbm$5uo$1@mail.pl.unisys.com...
Quote
> My app uses TTable (a long story), to perform inserts, edits etc on a
> dataset. I'd like to have an identity, or some kind of auto increment
colum,
> in a table but, when I pass the data to the other columns (using SetData)
I
> get an error on passing a null value into the ID column. Can anyone help?

Other Threads