Reputation: 31
I am trying to use an access database to create a login for a Hotel reservation system in C#, unfortunately I have run into a problem with the following error;
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Most of the research I done with this was that people did not have Access installed on their machines. But as I do have it installed and still get this problem I am getting very confused over this. If anyone has any suggestions or solutions to this I would be grateful!
I am using a file reader class and for any of the methods in the class it always displays the error at the "Conn.Open()" command, here is my code for one of the methods.
public DataTable LoadLogin() { string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:"Not getting my connection string :p"; DataTable results = new DataTable();
using (OleDbConnection conn = new OleDbConnection(connString))
{
OleDbCommand cmd = new OleDbCommand("SELECT User_Name, Password FROM Employee", conn);
conn.Open();
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.Fill(results);
}
return results;
}
Upvotes: 3
Views: 338
Reputation: 1206
This is likely due to the fact that you are compiling and running 32-bit, but are using the 64-bit Access driver. The other possibility is that you have the 32-bit version of Access installed in which case you need to compile and run your program for x86 using "Microsoft.Jet.OLEDB.4.0"
as your provider string.
Unfortunately, you can't mix-and-match the bitness of your program with the bitness of the Access provider you are using.
Upvotes: 3