« Detect and remove Byt… | Home | CURL with GoDaddy »

Connecting to Microsoft Visual FoxPro

If you ever need to connect to a Microsoft Visual FoxPro database from FileMaker, Xojo or Real Studio, you can use our MBS Plugin to do this.

We simply use the built in ODBC driver from Microsoft to connect. Our connection string is configured to work without setting up a data source. This avoids users to configure their system and just provide the path to the database file.

The connection string looks like this:

"Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\test.dbc;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;"

So we provide the name of there drive, the type of source (database file), the path to the database file and a few options. Maybe you don't need all those options.

Below the FIleMaker script to connect. Please notice that we pass empty username and password after the connection string. And the last parameter is the client type which is always "ODBC" here.

Set Variable [$Connection; Value: MBS("SQL.NewConnection")]
Set Variable [$result; Value: MBS("SQL.Connect"; $Connection; "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\test.dbc"; ""; ""; "ODBC")]

In Xojo (or Real Studio) with SQL Connection we simply set database connections string and type to connect:

dim con as new SQLConnectionMBS
const db = "ODBC:Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\test.dbc"

In Xojo (or Real Studio) with SQL Database we have to prefix the connection string with "ODBC:" to

dim db as new SQLDatabaseMBS
db.DatabaseName = "ODBC:Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=c:\test.dbc"
if db.Connect then

So the next time you have a client with a FoxPro Database where you need import/export from FileMaker, Xojo or Real Studio, our plugin may come to rescue! Claris FileMaker Plugin
17 11 14 - 20:54