views:

45

answers:

3

I need to import tables from foxpro 8.0 to sql server. How do I read the tables & schema from a foxpro directory/files in C# so I can create the tables in SQL Server and copy the data over?

A: 

Hi! You can use ODBCConnection. I know foxpro is using .dbf files.

OdbcConnection Conn = new OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=C:\\tbl.dbf;");
        String SQL = "SELECT * FROM tbl.dbf";
        Conn.Open();
        OdbcCommand MyCommand = new OdbcCommand(SQL,Conn);
        OdbcDataReader dr = MyCommand.ExecuteReader();
        while (dr.Read())
        {
           //your code
        }
RJ1516
A: 

With exception of the "Driver" providd by RJ's answer, go to MS and get the VFP OleDB provider... You might have compatibility issues if dealing with a database container.

DRapp