DBSETPROP( ) Function

Example   See Also

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

Syntax

DBSETPROP(cName, cType, cProperty, ePropertyValue)

Returns

Logical

Arguments

cName

Specifies the name of the database, field, named connection, table, or view for which a property is set.

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:

customer.custid

cType

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
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.

cProperty

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( ).

ePropertyValue

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

Caution   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 isn't valid for the field, and Visual FoxPro will not generate an error.

Remarks

Use DBSETPROP( ) to set properties for the current database, or fields, named connections, tables, or views in the current database. Use DBGETPROP( ) to determine the current property values.

DBSETPROP( ) returns true (.T.) if Visual FoxPro successfully sets the property you specify. Visual FoxPro generates an error if the property you specify cannot be set.

For more details about the properties you can get for connections, databases, fields, tables, and views, refer to the topics listed in the following table.

For details about Refer to this section In this chapter of the Programmer's Guide
Database properties "Viewing and Setting Database Properties" Chapter 7, Working with Tables
Connections "Accessing Remote Data" Chapter 8, Creating Views
Views Chapter 8, Creating Views
Triggers "Using Triggers" Chapter 7, Working with Tables
Captions "Creating Captions for Fields" Chapter 7, Working with Tables
Default values "Creating Default Field Values" Chapter 7, Working with Tables
"Creating Default Values for View Fields" Chapter 8, Creating Views
Comments "Adding Comments to Fields" Chapter 7, Working with Tables
"Viewing and Setting Database Properties" Chapter 6, Creating Databases
Primary key "Controlling Duplicate Values" Chapter 7, Working with Tables
Rules "Enforcing Business Rules" Chapter 7, Working with Tables
"Setting or Changing Field-level or Table Rules" Chapter 7, Working with Tables
"Creating Rules on View Fields and Rows" Chapter 8, Creating Views