I was wondering if this Option could Default to True instead of False.
I would have thought that the point of setting default values when creating tables is that you want these values inserting by default.
I keep having to go back to table/query components and setting this option to True because I've forgotten to set it at the time of creation.
If people disagree, so be it, but it would save time for me.
Alan
"TCustomMyDataSet.Options.DefaultValues" Default Value
When the TCustomMyDataSet.Options.DefaultValues property is set to True, TCustomMyDataSet fills the DefaultExpression property of TField objects by default values from corresponding table.
If you have already created the table, you can change the default value of the needed field using the following statement:
If you have already created the table, you can change the default value of the needed field using the following statement:
Code: Select all
ALTER TABLE tablename ALTER COLUMN fieldname SET DEFAULT TRUE;Sorry, there seems to be some confusion.
I have set up fields with default values in my tables, however, they are only called into data access components by your TMyQuery and TMyTable if the DefaultValues in Options is set to True. This Option is set to False by default, so if you want your Default values that you have set up in your MySQL tables you have to go into the Options of the TMyQuery and TMyTable components and set the DefaultValues option to True manually.
I was hoping you would set this Option to True by default.
I have set up fields with default values in my tables, however, they are only called into data access components by your TMyQuery and TMyTable if the DefaultValues in Options is set to True. This Option is set to False by default, so if you want your Default values that you have set up in your MySQL tables you have to go into the Options of the TMyQuery and TMyTable components and set the DefaultValues option to True manually.
I was hoping you would set this Option to True by default.
The TCustomMyDataSet.Options.DefaultValues property is needed only to fill the DefaultExpression property of the TField objects.
DefaultExpression provides a default value for a field in which on inserting a new record the value is not set by user. However, on the MySQL server such fields are filled with default values in any case.
If TCustomMyDataSet.Options.DefaultValues is False, then, on inserting a new record, fields in TDataSet with unset values will have the NULL value. However, on calling the Refresh method, these fields will be set to default values.
DefaultExpression provides a default value for a field in which on inserting a new record the value is not set by user. However, on the MySQL server such fields are filled with default values in any case.
If TCustomMyDataSet.Options.DefaultValues is False, then, on inserting a new record, fields in TDataSet with unset values will have the NULL value. However, on calling the Refresh method, these fields will be set to default values.