RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TField.CustomConstraint Property

Specifies an SQL string the enforces any application-specific constraints on the field's value.

Pascal
property CustomConstraint: string;
C++
__property AnsiString CustomConstraint;

Set CustomConstraint to limit the values that the user can enter into a field. CustomConstraint must be a valid SQL search expression such as

x > 0 and x < 100

The name used to refer to the field's value can be any string that is not a reserved SQL keyword, as long as it is used consistently throughout the constraint expression. 

Custom constraints are imposed in addition to any constraints to the field's value that come from the server. To see the constraints imposed by the server, read the ImportedConstraint property.

Note: When setting the CustomConstraint property, be sure to set the ConstraintErrorMessage property as well, so that a message can appear when the user enters a value that violates the custom constraint.
Note: Custom constraints are SQL expressions. Because of this, always use a period (.) as a floating-point separator. This may be inconsistent with international Windows
environment settings.  

 

ConstraintErrorMessage 

ImportedConstraint 

Constraining Data Values

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!