OLE DB Provider for Visual FoxPro

The Visual FoxPro OLE DB Provider (VfpOleDB.dll) exposes OLE DB interfaces that you can use to access Visual FoxPro databases and tables from other programming languages and applications.

The Visual FoxPro OLE DB Provider includes the following:

  • Support for most Open Database Connectivity (ODBC) driver functionality from earlier versions of FoxPro

  • Improved threading model for scalability

    Note

    Visual FoxPro OLE DB Provider does not support multiple result sets.

  • Enhanced functionality for and access to stored procedures

    Stored procedures return scalar results in row sets and can accept parameters. The Visual FoxPro OLE DB Provider implements the ICommandPersist interface so that you can create, modify, and delete stored procedure code and modules.

  • Support for DBC events and the capability to create, modify, and delete functions and procedures in the DBC stored procedure module

  • Support for the following Schema Rowsets: Table, Column, Provider Types, Indexes, Primary Keys, Procedures, Foreign Keys, Views, Table Constraints, Check Constraints, and Referential Constraints

  • Recognition of any valid Visual FoxPro configuration file (.fpw) that is stored in the same directory as the Provider. However, only the following settings in the configuration file are recognized by the Provider.

    • MVCOUNT which sets the maximum number of variables that Visual FoxPro can maintain.

    • ENGINEBEHAVIOR which specifies the Engine compatibility level.

    • TABLEVALIDATE which specifies the level of table validation to perform.

    • REFRESH which specifies how often local memory buffers are refreshed with changes from other users on the network.

You can perform the following functions through the Visual FoxPro OLE DB Provider:

  • Access Visual FoxPro data from external applications.

  • Create n-tier thin and fat clients that access legacy Visual FoxPro data.

  • Use a subset of the Visual FoxPro language in database stored procedures.

  • Create and maintain database containers (DBCs) through extended Data Manipulation Language (DML) functionality and ADOX enhancements to ADO.

The Visual FoxPro OLE DB Provider is supported by OLE DB System Components as provided by MDAC 2.6 or later. The requirements to run the Visual FoxPro OLE DB Provider are the same as for this version of Visual FoxPro.

Note

When you use Visual FoxPro OLE DB Provider as a SQL Server-linked server, only queries are supported. The Visual FoxPro OLE DB Provider does not support update, insert, or delete operations through a linked server.

Correlation Between Visual FoxPro OLE DB Methods and ODBC Driver Functions

OLE DB and ODBC are different interfaces. No one-to-one correspondence exists between the properties of one interface and the attributes of the other. OLE DB contains a rich definition of property sets and interface method parameters that provide services significantly different from those provided by ODBC.

For more information, see the OLE DB documentation of schema rowsets, property sets, and methods. For a discussion on OLE DB relative to ODBC, see the MSDN article "OLE DB for the ODBC Programmer."

Stored Procedures in the OLE DB Provider

The Visual FoxPro OLE DB Provider accepts stored procedure commands in the following formats:

  • Calling a stored procedure using the conventional syntax:

    myStoredProc( Param1, Param2, ... )
    
  • Calling a stored procedure using the SQL EXEC keyword with the following syntax:

    EXEC myStoredProc( Param1, Param2, ... ) 
    

    where each parameter is in the format expected for its data type or is a valid expression that returns that format as in the following example:

    EXEC myStoredProc( 'characterparm', {^2002/09/09}, dateTime(), 100, 99.99, .T.)
    

    Note

    Be sure to replace myStoredProc with the name of the stored procedure you want.

    Tip

    When you are using ADO or ADO.NET and setting the Command Type to Stored Procedure, you do not need to include the EXEC keyword. If the Command Type is not set to Stored Procedure, you must use the conventional syntaxfor stored procedures or use the EXEC keyword.

Registry Entries

When you install the Visual FoxPro OLE DB Provider, the installation program updates your system registry, HKEY CLASSES_ROOT, and adds the following new keys:

HKEY_CLASSES_ROOT\VFPOLEDB

HKEY_CLASSES_ROOT\VFPOLEDB.1

HKEY_CLASSES_ROOT\Vfpoledb.ConnectionPage

HKEY_CLASSES_ROOT\Vfpoledb.ConnectionPage.1

HKEY_CLASSES_ROOT\VFPOLEDB.ErrorLookup

HKEY_CLASSES_ROOT\VFPOLEDB.ErrorLookup.1

International Support

The Visual FoxPro OLE DB Provider provides international language support for the following:

  • Double-byte character sets (DBCS)

  • Multiple collating sequences

    A collating sequence defines the sort order for data stored in a Visual FoxPro table or database. The Visual FoxPro OLE DB Provider is configured to use collating sequences that support the language version of your operating system by default.

See Also

Tasks

How to: Access Visual FoxPro Data in Visual Studio
How to: Access Visual FoxPro Data in Microsoft Office

Reference

Language Reference for OLE DB Development

Other Resources

Visual FoxPro Data Access Using the OLE DB Provider