Tuesday, February 15, 2011

9 EASY STEPS Connect Visual Foxpro With MySQL

Visual FoxPro or VFP is often referred to as integration with its own relational database engine which extends FoxPro's xbase with the ability to support SQL query also data manipulation. In other words, VFP has its own database to store all data that has been entered into the user's application of this service. But in VFP different database with the database that we often encounter, such as MySQL, Oracle, MSSQL, etc.. What distinguishes a database from the fox-pro with other databases can be seen from the capacity of its maximum capacity. VFP Database accommodate, much less data than the stand-alone database (MySQL, Oracle, MSSQL), and it became the main feature of the VSP database with 3rd party database capacity. 3rd party database record can accommodate more than its own database of VSP. Here we will try to incorporate Visual Foxpro application with MySQL database. This is very useful for people using VFP database to add more data capacity. The steps can you see below:

Before starting pengoneksian VFP to MySQL, preparations [my first software needed, following the required software. 
1. MySQL database, here using XAMPP, which includes the MySQL database and phpMyAdmin. 
2. Visual Foxpro 9 (VFP) 
3. MySQL ODBC connector 5.1.8-win32.msi, its application can be downloaded at the site (http://dev.MySQL.com/download/connector/odbc/)

Step 1 
If the required software already installed, just install the MySQL Connector ODBC. Now go to Control Panel> Administrative Tools> Data Sources (ODBC). You will see the display as shown below.

Step 2 
In the DSN user clicks the Add button to exit the view as figure 2. Now you observe Figure 2, there choose MySQL ODBC 5.1 Driver (figure 3)> click finish.

Step 3 
Previous step, is a way to mengoneksikan or bridge between Visual Foxpro application with the MySQL database (Figure 4). Before we mengoneksikannya first make sure the active MySQL database. Continue on figure 5, we use a database with the name "db_sql" which was made before. And to please your password adjust.

Step 4 
Finally, test whether the MySQL database has been connected with Visual Foxpro. Once we fill in the fields above (figure 5), please click the test button. If successful it will appear like picture 6 "successfull connection", it proves successful MySQL database connected.

Step 5  
If you already click OK on the form figure 6, the Data Source Name is automatically added to the list of User Data Source. The name "connection" is what will be called when doing coding in VFP.

Step 6 
After we signed on Visual Foxpro application. Figure 8 is an example form that will be used for simple experiments.

Step 7 
To save input from VFP to MySQL database, we need to call the function "connection" that we created earlier. Place the script (figure 8) is on the form - load.
Then on the save button enter the following command to input data into tables in a MySQL database Muser.

SET ANSI ON SQLEXE (P1, "INSERT INTO Muser (ID, name, address, phone) VALUES ('" + thisform.tx_ID.value +"','"+ thisform.tx_nama.value +"','"+ thisform.tx_alamat.value + " ','"+ thisform.tx_tlp.value +"');") 

Here is an example of data with input from Visual Foxpro application on phpMyAdmin. We must emphasize the link with the MySQL database is VFP ODBC Drive previously had to be installed. So, although you are still using VFP database, you still can save a lot by utilizing data from the MySQL database.

Source: Komputek Magazine Issue 709 


  1. Can you please fix the images? I am trying to do this same thing but you make references to images that no longer exist. Thanks for your post!

  2. Hello there, I discovered your website by the use
    of Google even as searching for a related topic, your website got here up, it seems to be good.
    I have bookmarked it in my google bookmarks.

    Hi there, just was aware of your blog through Google, and
    found that it's really informative. I'm gonna watch
    out for brussels. I will be grateful in the event you proceed this
    in future. A lot of folks will probably be benefited from your
    writing. Cheers!

    Also visit my blog post - 3d airplane games

  3. what can i do to reverse fatty liver disease what can i
    do to reverse fatty liver disease what can i do to reverse fatty liver disease

    my web blog fatty liver disease diet coke

  4. I have been searching for this information. Thanks for posting.
    Foxpro Application