Click or drag to resize

DbSetProp Function

X#
Sets a property for the current database or for fields, named connections, tables, or views in the current database.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION DbSetProp(
	cName AS STRING,
	cType AS STRING,
	cProperty AS STRING,
	ePropertyValue AS USUAL
) AS USUAL
Request Example View Source

Parameters

cName
Type: String
Specifies the name of the current open database or the field, named connection, table, or view in the current open database for which DbGetProp( ) returns information.
To set a property for a field in a table or a view, preface the name of the field with the name of the table or view containing the field. For example, to set a property for the custid field in the customer table, specify the following for cName:
X#
1customer.custid
cType
Type: String
Specifies whether cName is the current database or for a field, named connection, table, or view in the current database. The table in the remarks section lists the values you can specify for cType.
cProperty
Type: String
Specifies the name of the property to set. If a property is read-only, its value cannot be changed with DbSetProp( ). If you attempt to set a property that is read-only, X# generates an error message.
For more information on properties you can specify with cProperty, including their data types, see DbGetProp( ).
ePropertyValue
Type: Usual
Specifies the value to which cProperty is set. ePropertyValue must be the same data type as the property's data type.
Note Note
X# does not verify that the value you specify is valid for the property. Thus, it is possible to set a property to an invalid value with DbSetProp( ). For example, DbSetProp( ) can be used to set a field rule expression to an expression that is not valid for the field, and X# will not generate an error. To avoid an error when setting the Tables property of a view, precede ePropertyValue with the database designation in the following syntax:
X#
1<databaseName>!ePropertyValue

Return Value

Type: Usual
Logical data type. DbSetProp( ) returns True (.T.) if X# successfully sets the property you specify. X# generates an error if the property you specify cannot be set.
Remarks
cTypedescription
ConnectioncName is a named connection in the current database.
DatabasecName is the current database
FieldcName is a field in the current database
TablecName is a table in the current database
ViewcName is a view in the current database

For more information about retrieving current property values, see DbGetProp( ) Function.
Examples
X#
1Close Databases
2Clear
3Open Database (HOME(2) + 'data\testdata')
4Use customer     // Open customer table
5= DbSetProp("customer.cust_id", "Field", "Comment", ;
6"Property has been set by DbSetProp.")  // New field comments
7cRESULTS = DbGetProp("customer.cust_id", "Field", "Comment")
8WAIT "Cust_id field comments: "+ cRESULTS  // Display comments
See Also