在ODBC中连接Excel时出现此错误:
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>
这是我的代码:
string ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Dbq=" + path + ";";
OdbcConnection cnn = new OdbcConnection();
cnn.ConnectionString = ConnectionString;
cnn.Open();
我已经安装了this驱动程序。