Condividi tramite


Application Creation with Accuracy and Data Integrity

You can combine the power of Visual FoxPro data validation rules and stored procedures with the data source's data validation rules and stored procedures to build client/server applications that protect data integrity.

Maintaining Data Integrity

You can create local versions of remote server validation rules to provide friendly messages to the user; for example, provide messages about updates that would not be allowed when sent to the remote server because the data entered had violated some server relational integrity or data validation rule.

Using Visual FoxPro Rules on a Remote or Offline View

You can create field- and record-level rules on remote and offline views to validate data entered locally before the data is sent to the remote data source. Because the purpose of these view rules is to prevent sending data to the data source that will be rejected by the server's data integrity rules, you want to replicate the data source's rules in the rules you create for your remote view. You use the DBSETPROP( ) function to create rules for views.

Tip   You can create a local validation rule on a remote view that calls a remote server stored procedure and sends the value you want to validate to the server as a parameter. However, using a remote stored procedure adds to processing time during data entry.

Using Server Rules

You can choose to rely on the rules established on the server for data validation. If an error occurs, your error handling routine can call the AERROR( ) function to obtain information, including the error message number, the text of the remote error message, and the connection handle associated with the error.

Using Server Triggers

Though you can create Visual FoxPro triggers on local tables, you can't create them on views. You can, however, use triggers on the remote data source. Server triggers can be used to process secondary data updates, such as cascading updates or deletes. Using server triggers to process secondary updates is more efficient than sending multiple commands to the remote server from your Visual FoxPro application.

Protecting Against Data Loss

Both Visual FoxPro and most remote data sources provide transaction-logging capabilities to protect against data loss. For more information, see Programming for Shared Access.

You can use Visual FoxPro transactions for local prototypes and for processing local data. Use server transactions for remote data updates, inserts, and deletes. For more information, see Optimizing Client/Server Performance.

See Also

Rapid Application Development | Client/Server Application Design | Selection of the Right Methods | Data Location on the Optimal Platform | Implementing a Client/Server Application