DbSetProp Function | |
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
public static Usual DbSetProp(
string cName,
string cType,
string cProperty,
Usual ePropertyValue
)
Request Example
View SourceParameters
- 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:
- 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 |
---|
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:
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 cType | description |
---|
Connection | cName is a named connection in the current database. |
Database | cName is the current database |
Field | cName is a field in the current database |
Table | cName is a table in the current database |
View | cName is a view in the current database |
For more information about retrieving current property values, see DbGetProp( ) Function.
Examples 1Close Databases
2Clear
3Open Database (HOME(2) + 'data\testdata')
4Use customer
5= DbSetProp("customer.cust_id", "Field", "Comment", ;
6"Property has been set by DbSetProp.")
7cRESULTS = DbGetProp("customer.cust_id", "Field", "Comment")
8WAIT "Cust_id field comments: "+ cRESULTS
See Also