Determining AUTO_INCREMENT field in dataset

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sdaberle
Posts: 7
Joined: Tue 12 Sep 2017 16:34

Determining AUTO_INCREMENT field in dataset

Post by sdaberle » Wed 17 Oct 2018 20:18

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?

ViktorV
Devart Team
Posts: 2388
Joined: Wed 30 Jul 2014 07:16

Re: Determining AUTO_INCREMENT field in dataset

Post by ViktorV » Fri 19 Oct 2018 09:36

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

Post Reply