0

私はこのようなことをしようとしています:

        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();

そして私はこの例外を受け取ります

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

問題は、同じコードがwindiws XP、Visual Studio 2010、Office 2007で正常に実行され、Windows 7 64ビット、Visual Studio 2008、Office2010では機能しないことです。勝つために7。いくつかのヒントは素晴らしいでしょう。ありがとう。

4

1 に答える 1

0

価値があるので、VistaとWindows 7で次の接続を使用してdBaseファイルを操作します。それでも、ターゲット出力を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))))
{
    //....
    //....
}

出力フォルダ名は、書き込みまたは読み取りを行っているDBaseファイルが置かれているディレクトリです。

于 2010-09-03T19:18:01.150 に答える