A
Alan White
Hello, I need to read the excel file using Odbc, but when I run my code, I
got the following error:
"Error: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified"
Could someone please tell me what is wrong with this?. Here is the code I
use to read the file.
I already include the Microsoft.Data.Odbc and add reference to Excel10.
Thank you
String sConnectionString = "Provider=MSDASQL;Driver={Microsoft Excel
Driver(*.xls)};DBQ=c:\\temp\\Sale_Test.xls;;;Extended
Properties=Excel10.0;HDR=No;";
// Create connection object by using the preceding connection string.
objConn = new OdbcConnection(sConnectionString);
OdbcCommand objCmdSelect =new OdbcCommand();
objCmdSelect.Connection = objConn;
objCmdSelect.CommandText = "Select * From [Week1$]";
objConn.Open();
got the following error:
"Error: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified"
Could someone please tell me what is wrong with this?. Here is the code I
use to read the file.
I already include the Microsoft.Data.Odbc and add reference to Excel10.
Thank you
String sConnectionString = "Provider=MSDASQL;Driver={Microsoft Excel
Driver(*.xls)};DBQ=c:\\temp\\Sale_Test.xls;;;Extended
Properties=Excel10.0;HDR=No;";
// Create connection object by using the preceding connection string.
objConn = new OdbcConnection(sConnectionString);
OdbcCommand objCmdSelect =new OdbcCommand();
objCmdSelect.Connection = objConn;
objCmdSelect.CommandText = "Select * From [Week1$]";
objConn.Open();