| Delphi .NET (2) Database (71) Delphi IDE (89) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280) |
How to specify a DefaultExpression for a TField object
If you set up a field attribute set and associate that set with a field in your table that will
MyField.DefaultExpression := 'MyValue'; // (Wrong)
It will compile but you will not get a default value at runtime when you create a new recordin the table by, say, clicking on the + on the DBNavigator. To get the default value to take at runtime the code assignment needs to be:
MyField.DefaultExpression := '''MyValue'''; // (Correct)
In the Object Inspector you just need to put 'MyValue'. Use single quotes in the ObjectInspector.
Comments:
| |||||||||