Excel connection using ODBC

Hi All, 

not sure if anyone of you connect to ODBC excel driver using the SQLConnect function?

I tested the connection string using powershell and it working fine
PS > $ExcelFilePath='D:\Book1.xlsx' #the full path of the excel workbook
PS > $Connection = New-Object system.data.odbc.odbcconnection
PS > $Connection.ConnectionString = 'Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ='+$ExcelFilePath+'; Extended Properties="Mode=ReadWrite;ReadOnly=false; HDR=YES"'

but when try connect using cicode SQLConnect(sConnectionString) error was return.
Below is the connection string i used in cicode
  STRING sConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=D:\Book1.xlsx;Extended Properties='Mode=ReadWrite;ReadOnly=false;HDR=YES';";

Is it something wrong with my connection string?

Many thanks for any suggestion.
Yeap

Parents Reply Children
No Data