ODBC连接时报错不可识别的数据库格式

报这个错误是因为Acess的版本不同。

 

 

2003版本的Acess的数据连接字符串:

 string dataBasePath = @"C:/Users/user/Documents/Test.mdb";

 string connectionString = "provider=microsoft.jet.oledb.4.0;Data Source=" + dataBasePath + ";";

 

2007版本的Acess的数据连接字符串:

string dataBasePath = @"C:/Users/user/Documents/Test.accdb";

string connectionString = "provider=microsoft.ace.oledb.12.0;Data Source=" + dataBasePath + ";";

 

所以需要看一下ODBC连接驱动的后缀名是否和数据库后缀名一致。

posted on 2020-01-06 16:13  格物致知2019  阅读(946)  评论(0编辑  收藏  举报

导航