Who can tell me?

river 2000-04-06 08:41:00
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!
...全文
87 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
billie 2000-04-06
  • 打赏
  • 举报
回复
简单地说,第一个是指当用户输入时,对输入值进行的强制检查标准;
第二个是指当用户没有对此字段进行输入时的默认值。
如果你用过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

'12:00:00'

including the quotes around the literal value.

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧