【发布时间】:2011-10-17 12:20:45
【问题描述】:
我目前正在使用 c# 访问 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`
【问题讨论】: