2011-10-17 107 views
4

我目前正在訪問一個訪問2010年數據庫在c#中,它無法打開數據庫,因爲它似乎沒有正確的驅動程序,當我使用.mdb這工作,但現在我正在使用.accdb,它似乎不想打開數據庫。這是開放代碼。我想知道你有什麼可以幫助我嗎?在c中使用Access 2010數據庫#

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` 

回答

相關問題