Can someone help me with this error? When I try to open a connection to an mdb, I get "The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine" error. How can I correct this?
My code is pretty simple:
class ImportTDB {
private string filename;
private string connectionString;
private int collisions = 0;
public ImportTDB(String filename) {
this.filename = filename;
this.connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename;
}
public void loadCustomerList() {
DataTable dt = new DataTable();
using (OleDbConnection conn = new OleDbConnection(connectionString)) {
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Names", conn);
conn.Open();
adapter.Fill(dt);
conn.Close();
}
Console.WriteLine(dt.ToString());
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…