OleDbDataAdapter does not imports Selected column

222 views Asked by At

I Use the OleDbDataAdapter to read values from incomming Excel (xls) file. My connection looks like:

string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dataFilePath + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text;';";

However I have problem with case, when the incoming file column has selection. It means when I open the original file, I see that the entire first column (except the firs cell which is a column header) is selected. This causes the problem for me, because he OleDbDataAdapter skips this entire column to import to the DataTable. Has anybody any suggestions for solving this problem? Thanks in advance.

UPDATE: If I open the file, and remove the selection (just by clicking with mouse on some cell) and save the file, the reading works good. But this is some workaround, I don't want to check for selection and resave the file each time. It should be some solution for this case...

0

There are 0 answers