Sorry,I use a traditional Chinese system so I write my question in English. Who can tell me how to use the 'customconstraint' and 'defaultexpression' properties of TStringField? Thank you!
...全文
931打赏收藏
Who can tell me?
Sorry,I use a traditional Chinese system so I write my question in English. Who can tell me how to use the 'customconstraint' and 'defaultexpression' properties of TStringField? Thank you!
简单地说,第一个是指当用户输入时,对输入值进行的强制检查标准;
第二个是指当用户没有对此字段进行输入时的默认值。
如果你用过ACCESS,对这些应该比较好理解。
从DELPHI中得来的帮助:
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 value of the field 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抯 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 will appear to the user when a value is entered 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 settings.
==========
Specifies an SQL expression that is assigned to the field if the user does not provide a value.
property DefaultExpression: String;
Description
Set DefaultExpression to provide a default value for a field. DefaultExpression can be any valid SQL value expression that does not refer to field values. If the expression contains literals other than numeric values, they must appear in quotes. For example, a default value of noon for a time field would be