Introduction – CursorAdapters

Visual FoxPro 8.0 introduced the CursorAdapter class primarily to support remote data connectivity to a wider range of data sources. Prior to VFP 8.0, you could access remote ODBC data sources in a VFP application using remote views. With the CursorAdapter class, you can not only access remote ODBC data sources, but you can also access remote ADO and XML data sources as well as native VFP data. The CursorAdapter class allows you to work with different data source types as native Visual FoxPro cursors. CursorAdapter objects serve as a pipeline that renders data from a data source into a Visual FoxPro cursor.

VPM Enterprise 9.1 introduces extensive support for using CursorAdapters in your applications. VPME now treats CursorAdapters just like tables and views to the extent feasible. Therefore, much of what you learned in the preceding Building Data: Tables and Building Data: Views chapters applies to the creation of and setup of CursorAdapters for a VPME application.

Tip – Use the Data Builder: In VPME, you should create, add and set up CursorAdapters in the Data Builder. When you set up CursorAdapters in the Data Builder, your Application Objects that use the CursorAdapters enjoy all the benefits of the VPM Enterprise fully-active data dictionary.

The VPM Enterprise form toolbar, form classes, form builders and SQL Find Form work with CursorAdapters just like they work with tables and views. This chapter describes how to create, set up and use CursorAdapters in a VPM Enterprise 9.1 application.

Tip - Northwind ODBC Data Source: To illustrate the creation of a CursorAdapter that accesses remote data, we will use the Northwind MS Access database also used in Creating and Setting Up Remote Views. While you will probably use a different type of remote data source (SQL Server or Oracle databases, for example) in your applications, the principles involved in creating CursorAdapters are the same.

Tip – VFP 9.0 Northwind Database: If you don’t have the Northwind MS Access database, you can follow along in this chapter by creating a CursorAdapter based on the “native” data source that comes with Visual FoxPro 9.0 – the Northwind database located in your MS VFP 9\Samples\Northwind directory.

Tip: If CursorAdapters are new to you, be sure to read the Visual FoxPro Help topics that describe the CursorAdapter class and related topics. In particular, read the topics “Data Access Management Using CursorAdapters” and “Walkthrough: Retrieving Data from Different Data Sources”.



Create or Add a CursorAdapter Class Library