我目前正在使用 c# Access access 2010 数据库,但它无法打开该数据库,因为它似乎没有正确的驱动程序,当我使用 .mdb 时它可以正常工作,但现在因为我使用的是 . accdb 好像不想打开数据库。这是打开代码。我想知道您是否可以帮助我?
public void openDatabase(string dbname)
{
//dataBaseName = dbname;
dataBaseName = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=houses.accdb"; //Defines the location of the database and its type.
connection = new OleDbConnection(dataBaseName); //Creates a new OleDbConnection using the data from dataBase.
connection.Open(); //Opens the TCP/IP connection.
}`enter code here`
最佳答案
你需要改变:
Provider=Microsoft.Jet.OLEDB.4.0
到
Provider=Microsoft.ACE.OLEDB.12.0
关于c# - 在 C# 中使用 Access 2010 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7793632/