C
C#•3w ago
Jorram

Issues when attempting to use.Net 8 to connect to an Access database

Hello folks, Do some of you know how to connect a .NET 8 application with an Access database .accdb? I use this code, but I'm receiving this error: "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.." PS-1: Yes, I'm in a Windows environment. PS-2: Sorry I don't know where to post this.
public void Connection()
{
const string connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "C:\\Users\\MICRO-52\\Desktop\\EoExperience\\PreRegistro.mdb;";


const string insertSQL =
"SELECT * FROM PreRegistro;";

using (OleDbConnection connection = new OleDbConnection(connectionString))
{
OleDbCommand command = new OleDbCommand(insertSQL);

command.Connection = connection;

try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
public void Connection()
{
const string connectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "C:\\Users\\MICRO-52\\Desktop\\EoExperience\\PreRegistro.mdb;";


const string insertSQL =
"SELECT * FROM PreRegistro;";

using (OleDbConnection connection = new OleDbConnection(connectionString))
{
OleDbCommand command = new OleDbCommand(insertSQL);

command.Connection = connection;

try
{
connection.Open();
command.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
7 Replies
Jorram
JorramOP•3w ago
@Angius it's possible, right.... right?
Angius
Angius•3w ago
I mean, probably Also, did you, like, google the error? 'Cause I'm getting a lot of results Like, a lot All of them point to MS Access Redistributable 2010 needing to be installed
Jorram
JorramOP•3w ago
I mean... they usually tell you to download Access Database Runtime, but I already did that, but the issue persists.
Angius
Angius•3w ago
2010?
Jorram
JorramOP•3w ago
Ok... I don't know if I installed the 2010 version specifically... Nop I downloaded the 2016 version... Mb 🫠
Angius
Angius•3w ago
Yeah, six years too new for this project lmao
Want results from more Discord servers?
Add your server