0

I am developing using C#, and want to open mdb files and query their tables.
But I don't want to use any additional installations (MS Access Software or MS Access Engine). Is there any way to do that.
However, It is very necessary to run the application on AnyCPU with one version of it. Not one for 32bit neither one for 64bit.
Any Help Please?
With my respect.

Edit -
Someone said this question is answered with this old one but not!

The answer is what @GordThompson said in the comments - Thanks again for him.

In details, it is:

var connectionString = @"Driver={Microsoft Access Driver (*.mdb)};Dbq=" + path + ";";

using (var connection = new OdbcConnection(connectionString))
{
    connection.Open();

    DataTable Main = new DataTable();
    var cmd = new OdbcCommand("SELECT * FROM Main", connection);
    var adapter = new OdbcDataAdapter(cmd);
    adapter.Fill(Main);
}
AmD
  • 33
  • 1
  • 6
  • 1
    "It is very necessary to run the application on AnyCPU with one version of it." - Why? The only way to do it without any additional installation is to use the older 32-bit "Jet" driver that ships with Windows. Windows machines can run 32-bit apps, so just produce a 32-bit app and anyone can use it. – Gord Thompson Jul 05 '22 at 15:41
  • Use `Driver={Microsoft Access Driver (*.mdb)}` and target your build for 32-bit. – Gord Thompson Jul 05 '22 at 19:13

0 Answers0