Link to home
Start Free TrialLog in
Avatar of electricd7
electricd7

asked on

How to connect ODBC to FoxPro 2.6 DBF Files

I have 2 DBF files from a FoxPro 2.6 database program.  I have them in thier own directory and have created a system dns called "bbank_legacy" by using the Microsoft FoxPro VFP Driver.  I changed the options to "Free Table Structure" and pointed it at the correct folder.  I then wrote the following ASP Page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
      Dim conn
            Set conn = Server.CreateObject("ADODB.Connection")

      conn.Open "DSN=bbank_legacy"
      Set RS=Server.CreateObject("ADODB.Recordset")
      RS.Open "Select * from BBANK", conn
      While not RS.EOF
            Response.write RS("unit_num")&"<BR>"
            RS.Movenext
      Wend
      
      RS.Close
      Set RS = Nothing

      conn.Close
      Set con = Nothing
%>

When I run this file, I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC Visual FoxPro Driver]File 'bbank.dbf' does not exist.

/testing/foxpro1.asp, line 9


Anyone ever worked with FoxPro 2.6 DBF files?  I really need this, so 500pts!
Avatar of Ashley Bryant
Ashley Bryant
Flag of United States of America image

Use OLE DB

Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("bbank.dbf") &";Extended Properties=dBASE IV;User ID=Admin;Password=
Avatar of electricd7
electricd7

ASKER

Actually I just solved it myself by using "DBQ=C:\TEMP;Driver={Microsoft dBase Driver (*.dbf)};  DriverId=277;FIL=dBase4.0 " Thanks anyway!

ED7
But if you're set on ODBC...

Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq="& Server.MapPath("bbank.dbf") &";
Ahh...didn't see your post when I replied again.  Good man (or woman.  I dunno, hehe) fixing it on your own.
hehe Thanks!
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial