How to make auto increament key to trigger ?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
ZEuS
Devart Team
Posts: 240
Joined: Thu 05 Apr 2012 07:32

Re: How to make auto increament key to trigger ?

Post by ZEuS » Thu 23 Aug 2018 12:41

To prevent the "Field must have a value" error, you can use the following approaches:
1. Set the RequiredFields option of the TUniTable component to True before opening it

Code: Select all

tblPatients.Options.RequiredFields := False
But note that in this case all fields marked as NOT NULL will not be validated for a blank value before inserting a record.

2. Set the Required property of the particular field to True after opening the table

Code: Select all

tblPatients.FieldByName('ptient_id').Required := False

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: How to make auto increament key to trigger ?

Post by inageib » Mon 03 Sep 2018 08:15

@ZEuS

I dont understand you said to set required to to true but in the code you set it to false !! what is the correct sequence ?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: How to make auto increament key to trigger ?

Post by MaximG » Tue 04 Sep 2018 07:09

To prevent the "Field must have a value" error, you can use the following approaches:
1. Set the RequiredFields option of the TUniTable component to False before opening it (tblPatients.Options.RequiredFields := False). But note that in this case all fields marked as NOT NULL will not be validated for a blank value before inserting a record.
2. Set the Required property of the particular field to False after opening the table (tblPatients.FieldByName('ptient_id').Required := False).

We apologize for the typo made in the previous answer

Post Reply