Page 1 of 1

Determining AUTO_INCREMENT field in dataset

Posted: Wed 17 Oct 2018 20:18
by sdaberle
I see how to use TCustomMyDataSet.InsertID to determine the last AUTO_INCREMENT value inserted in a dataset. Is there a way I can determine, generically, which column that AUTO_INCREMENT value is in?

Re: Determining AUTO_INCREMENT field in dataset

Posted: Fri 19 Oct 2018 09:36
by ViktorV
You can define whether a field is auto-incremental in the following way:

Code: Select all

  if MyQuery.GetFieldDesc('YourField').IsAutoIncrement then
    // ...  Field is AutoIncrement