tags:

views:

2132

answers:

3

Hi,

I'm trying to read a Paradox 5 table into a dataset or simular data structure with the view to putting it into an SQL server 2005 table. I've trawled google and SO but with not much luck. I've tried ODBC:

public void ParadoxGet()
{
    string ConnectionString = @"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=C:\Data\;Dbq=C:\Data\;CollatingSequence=ASCII;";

    DataSet ds = new DataSet();
    ds = GetDataSetFromAdapter(ds, ConnectionString, "SELECT * FROM Growth");
    foreach (String s in ds.Tables[0].Rows)
    {
        Console.WriteLine(s);
    }
}
public DataSet GetDataSetFromAdapter(DataSet dataSet, string connectionString, string queryString)
{
    using (OdbcConnection connection = new OdbcConnection(connectionString))
    {
        OdbcDataAdapter adapter = new OdbcDataAdapter(queryString, connection);
        connection.Open();
        adapter.Fill(dataSet);
        connection.Close();
    }
    return dataSet;
}

This just return the error

ERROR [HY000] [Microsoft][ODBC Paradox Driver] External table is not in the expected format.

I've also tired OELDB (Jet 4.0) but get the same External table is not in the expected format error.

I have the DB file and the PX (of the Growth table) in the Data folder... Any help would be much appriciated.

+2  A: 

Maybe this will help you out,

http://support.microsoft.com/support/kb/articles/Q237/9/94.ASP?LN=EN-US&SD=SO&FR=1 http://support.microsoft.com/support/kb/articles/Q230/1/26.ASP

It appears that the latest version of the Microsoft Jet Database Engine

(JDE) does not fully support Paradox unless the Borland Database Engine

(BDE) is also installed.

MysticSlayer
A: 

This isn't an answer, but more of a question: any particular reason you're trying to use C# to do the data manipulation as opposed to using SQL Server tools to load the data directly? Something like DTS or SSIS would seem like a better tool for the job.

ahockley
A: 

Thanks, I'll give that a try. I wanted to use C# so I can put it on some web pages without the extra set of putting it in SQL server.