我正在尝试这样做:
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上运行,而不能在windows7 64位,visual studio 2008,office 2010上运行。我真的不知道有什么不同,我是新的赢家7。一些小贴士是great.Thanks。
发布于 2010-09-04 03:18:01
无论如何,我在Vista和Windows7上使用以下连接操作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文件所在的目录。
https://stackoverflow.com/questions/3638781
复制相似问题