I would like to run a c# code in windows 10(64bit). The code uses odbc to access to a Microsoft Access file. The code works well on PCs which have Microsoft Access 2010 and 2013. However it cannot access to the file on the PC which does not have Microsoft Access Application. Can I access to the file without Microsoft Access Application. Or do I need to install something more than "Microsoft Access Driver 64bit version" to access the file?
What I did are followings,
(1) I installed "Microsoft Access Driver (*.mdb, .accdb)" 64bit version. (2) I Confirmed ODBC data source administrator recognized ACEODBC.DLL as "Microsoft Access Driver (.mdb, *.accdb)".
The followings shows the part of code calling odbc driver.
public static DataTable simpleQuery(string query, string pathToDatabase )
{
DataTable dt = new DataTable();
try
{
using (var con = new OdbcConnection())
{
con.ConnectionString =
@"Driver={Microsoft Access Driver (*.mdb, *.accdb)};" +
@"Dbq=" + pathToDatabase + ";";
con.Open();
OdbcDataAdapter adapter = new OdbcDataAdapter(query, myConnectionString);
adapter.Fill(dt);
con.Close();
}
return dt;
}
catch (Exception e)
{
throw;
}
}
Thank you very much.