My intention here is to render the excel data in a table, using a datatable, so opened an odbc connection and loaded the datatable like this:
System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(Dsn=Excel Files;Driver={Microsoft Excel Driver (*.xls)};Driverid=790;Dbq=C:\Users\*******\Documents\Book1.xlsx;DefaultDir=C:\Users\******\Documents;HDR=YES);
conn.Open();
DataTable dataTable = new DataTable();
string con = "select * from [sheet1$]";
System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand(con, conn);
System.Data.Odbc.OdbcDataReader dr = cmd.ExecuteReader();
dataTable.Load(dr);
But insted getting an error like this
ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
So actually whats' the root cause ?