Error connecting Excel throw odbc in C#

2

Im getting this error when connecting Excel in ODBC:

  System.Data.Odbc.OdbcException occurred
      HResult=0x80131937
      Message=ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
      Source=
      StackTrace:
    <Cannot evaluate the exception stack trace>

This is my code:

string ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Dbq=" + path + ";";
            OdbcConnection cnn = new OdbcConnection();
            cnn.ConnectionString = ConnectionString;
            cnn.Open();

I have installed this driver.

c#
excel
odbc
asked on Stack Overflow Sep 9, 2017 by Carlos Palencia • edited Sep 9, 2017 by Carlos Palencia

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0