Reply to comment
Visual FoxPro ODBC driver
Visual FoxPro ODBC driver was last updated around VFP6 SP3. It supports a subset of VFP 6.0 features but not any new ones introduced in VFP7 and later. See VFP 6.0 Help file and Unsupported Visual FoxPro Commands and Functions (Visual FoxPro ODBC Driver) for additional information. It'll not recognize any tables that use VFP7 and later new features and either ignore them or give an error when trying to access them.
The VFP ODBC driver was included in MDAC 2.5 and earlier and preinstalled on Windows 2000 and earlier. In order to use it on Windows XP and later Windows versions, it has to be installed first. The Microsoft Visual FoxPro Driver 6.01.8629.01 is available for download at http://msdn.microsoft.com/en-us/vfoxpro/bb190233.aspx.
The VFP ODBC Driver can be installed under 64-bit Windows but 64-bit applications cannot access VFP ODBC driver because it comes only in 32-bit version. For 32-bit applications under 64-bit Windows there's ODBC Data Source Administrator for the 32-bit ODBC drivers %systemdrive%\Windows\SysWoW64\odbcad32.exe (usually C:\WINDOWS\SysWOW64\odbcad32.exe).
| Option | Connection string | Description | Notes |
|---|---|---|---|
| Collating sequence | Collate | The sequence in which fields are sorted. The default sequences reflect the sequences supported by your language version of the operating system. For a list of supported collating sequences, see SET COLLATE. | |
| Exclusive | Exclusive | Determines if the driver opens the Visual FoxPro database exclusively when you access data using the data source. Other users cannot access the database or the tables in the database while the database is opened exclusively. Tables within the exclusively opened database are opened as SHARED. To open a table exclusively, use the SET EXCLUSIVE command. This check box is disabled when Database type is set to Free Table directory. | Yes/No |
| Null | Null | Determines whether columns created with ALTER TABLE and CREATE TABLE allow null values. If you set Null ON, INSERT – SQL inserts a null value into any column not included in an INSERT – SQL... VALUE clause. A blank is inserted if Null is OFF. | Yes/No |
| Deleted | Deleted | Determines whether rows marked as deleted are returned. Deleted=Yes is the same as SET DELETED ON. | Yes/No |
| Fetch data in background | BackgroundFetch | Determines whether records will be fetched in the background (progressive fetching) or your application will wait until all records in the result set are fetched. It's recomended to set it to No. See PRB: Problems with Visual FoxPro Driver "Fetch Data In Background" Option for details. | Yes/No |
The code below shows how to use VFP ODBC in SPT with DSN-less connection.
| This is sample code. Add error handling and adjust to your requirements as necessary. |
CLEAR * Attempt to access Northwind.dbc with VFP ODBC driver will generate the error below because the DBC has DBC events enabled: * Connectivity error: [Microsoft][ODBC Visual FoxPro Driver]File was created in a later version of Visual FoxPro than the current version. *lcDbc = HOME(2) + "Northwind\Northwind.dbc" lcDbc = HOME(2) + "Data\testdata.dbc" TEXT TO lcConnStr TEXTMERGE NOSHOW DRIVER=Microsoft FoxPro VFP Driver (*.dbf); Deleted=Yes; Null=Yes; Collate=Machine; BackgroundFetch=No; Exclusive=No; SourceType=DBC; SourceDB=<<lcDbc>> ENDTEXT lnConn = SqlStringConnect(lcConnStr) IF lnConn < 0 =AERROR(laError) ? laError[1,2] RETURN ENDIF TEXT TO lcSql NOSHOW SELECT * FROM Products ENDTEXT lnResult = SQLEXEC(lnConn, lcSql, "crsProducts") IF lnResult < 0 =AERROR(laError) ? laError[1,2] RETURN ENDIF BROWSE LAST NOWAIT
Recent comments
1 week 4 days ago
4 weeks 19 hours ago
4 weeks 23 hours ago
4 weeks 1 day ago
4 weeks 1 day ago
5 weeks 2 days ago
8 weeks 2 days ago
10 weeks 4 days ago
12 weeks 2 days ago
12 weeks 3 days ago