dbgetprop( ) 函数示例

以下示例显示 customer 表主关键字的名称。然后显示 customer 表中 cust_id 字段的字段注释。如果此字段没有注释,显示一条表示没有字段注释的消息。如果要添加说明,请参阅稍后部分的语言参考“dbsetprop()函数”的示例。

close databases
clear
open database (home(2) + 'data\testdata')
* displays the primary key field
cresults = dbgetprop("customer", "table", "primarykey")
=messagebox(cresults)   && 显示  cust_id 字段
* displays comments for the field 'cust_id'
cresults = dbgetprop("customer.cust_id", "field", "comment")
if len(alltrim(cresults)) = 0
   =messagebox("no comment for this field." + chr(13) + ;
     chr (13) + "use dbsetprop( ) to add comments.")
else
   =messagebox("cust_id field comments: " + cresults)
endif