DBSETPROP( ) Function

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

DBSETPROP(cName, cType, cProperty, ePropertyValue)



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:

 CopyCode imageCopy Code

Specifies whether cName is the current database or for a field, named connection, table, or view in the current database.

The following table lists the values you can specify for cType:

cType Description


cName is a named connection in the current database.


cName is the current database.


cName is a field in the current database.


cName is a table in the current database.


cName is a view in the current database.


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, Visual FoxPro generates an error message.

For more information on properties you can specify with cProperty, including their data types, see DBGETPROP( ).


Specifies the value to which cProperty is set. ePropertyValue must be the same data type as the property's data type.

Caution noteCaution

Visual FoxPro 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 Visual FoxPro 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:

 CopyCode imageCopy Code

Expand imageReturn Value

Expand imageRemarks

Expand imageExample

Expand imageSee Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic