tags:

views:

194

answers:

1

I am trying to something like this:

        string pathFiles = Path.Combine(Application.StartupPath, "DB");
        string strconn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;" +
               "Dbq="+pathFiles+";";                      
        OdbcConnection odbconn = new OdbcConnection(strconn);
        odbconn.Open();

and i get this exception

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The problem is that the same code runs ok on windiws XP , visual studio 2010, office 2007 and it doesn't work on windows 7 64bit , visual studio 2008,office 2010. I really don't know whatvis the difference, i am new to win 7. Some tips would be great.Thanks.

A: 

For what it is worth, I manipulate dBase files using the following connection on Vista and Windows 7. I still set the target output as x86.

using (OleDbConnection connection = new OleDbConnection(string.Format("Provider=Microsoft.JET.OLEDB.4.0;" +
    "Data Source={0};Extended Properties=dBase IV;", Path.Combine(Environment.CurrentDirectory, OutputFolderName))))
{
    //....
    //....
}

The output folder name is just the directory where the DBase files that I'm either writing to or reading from.

Wil P