任何人都可以告诉如何在C#和.NET 4.0中使用odbc驱动程序连接MS Access 2010(.accdb)数据库

我试过了

string connetionString = ("Driver={Microsoft Access Driver(*.mdb*.accdb)};DBQ=C:\\Users\\Administrator\\Desktop\\New folder\\MatchDetails.accdb;");

OdbcConnection myConnection = new OdbcConnection(connetionString);

try
{
    myConnection.Open();
    MessageBox.Show("Connection Open ! ");
    myConnection.Close();
}
catch (Exception ex)
{
    MessageBox.Show("Can not open connection ! ");
}

抛出此异常

最佳答案

您的connection string中有错别字:

string connectionString = ("Driver={Microsoft Access Driver(*.mdb, *.accdb)};DBQ=C:\\Users\\Administrator\\Desktop\\New folder\\MatchDetails.accdb;");

(请注意驱动程序名称中的逗号)

09-12 07:31