I am new to C# and only need to use it because I want to read a really old MS Access 95 database file.
When I try to read the mdb file I get the The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. error. I read through some threads and know, that it probably is because of my OS being 64-bit and the driver being 32 bit. I also installed the newer driver which should support 32 and 64 bit systems, but I don't know what I exactly should do after installing it.
This is my code so far:
using System.Data.OleDb;
namespace Access_DB
{
class Program
{
public static void Main(string[] args)
{
//Console.WriteLine("\nWhat is your name? ");
ReadData("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\Users\\but\\Desktop\\Access-DB\\Test\\access" , "select * from summary_0199_550");
}
public static void ReadData(string connectionString, string queryString)
{
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
OleDbCommand command = new OleDbCommand(queryString, connection);
connection.Open();
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader[0].ToString());
}
reader.Close();
}
}
}
}``
I also read that I should force the application to run on 32 bit by setting the target to x86 in project properties, but I cannot find such an option in visual studio code. How do I change the target here?







