FoxPro DBF (with CDX and FPT) and ASP


  • Hi,


    I was wondering if it was possible to use a FoxPro DBF database with ASP and if so which ODBC I should use.


    How would that connection string look like?


    If you can, please include an SQL query to show if I should include the file name of the database or not.



    Thank you in advance.

    Tuesday, July 22, 2008 4:56 PM


All replies

  • yes you can access foxpro data files with .Net

    I am using C# to access data with

    here is code:
    I am using database you can also access a free table.

    private string dataPath = "d:\\fox\\daily\\data.dbc";
    string str;
    TreeView myMaster = (TreeView)Master.FindControl("treeThread");
     str = @"Provider=vfpoledb.1;Data Source=" + dataPath;
    OleDbConnection conn = new OleDbConnection(str);
    if (conn.State == ConnectionState.Open)
                str = "select code,lastuser from main";
                DataSet ds = objUtil.fill_data(str,conn, "main");
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    TreeNode tn = new TreeNode();
                    tn.Text = ds.Tables[0].RowsIdea[0].ToString();

    Here is by using ODBC
    string yourTablePath = @"c:\myData";
    OdbcConnection conn = null;
    str = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + yourTablePath +";Exclusive=No";           

    then connect in the same way as done for oleDb just use OdbcConnection properties & methods.

    Tuesday, July 22, 2008 5:08 PM
  • I am using traditional ASP (Active Server Pages), I don't know if you support that or not, but it is probably the same code anyway.


    I don't have a DBC file, only dbf, cdx and fpt. I don't really know how my data source should look like, the folder? The dbf path or just the file name without an extention?


    This are my files:

    data1.dbf, data1.fpt, data1.cdx

    data2.dbf, data2.fpt, data2.cdx


    I am using a local IIS 7.  Also I can't seem to find the vfpoledb driver, the link to microsoft foxpro in the ODBC Data Sources is not working.



    I get this error when I try to use the ODBC connection string:


    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

    [Microsoft][ODBC Driver Manager] Drivrer dosen't support that function (translated from Swedish)

    /default4.asp, line 16



    Set Conn = CreateObject("ADODB.Connection")

    Conn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" & Path & ";Exclusive=No" // Line 16

    Tuesday, July 22, 2008 5:36 PM
  • You should use VFPOLEDB. It is available fro public download at MS VFP downloads.


    Check these for samples:




    Tuesday, July 22, 2008 7:17 PM
  • You can download VFPOLEDB from Microsoft here.
    Tuesday, July 22, 2008 7:36 PM
  • The problem was that I didn't have sufficient rights to install VFPOLEDB, but even though it didn't install correctly it said that it was successfully installed.


    Thank you all, for your help.

    Friday, July 25, 2008 2:50 PM