Search code examples
c#.netlinq-to-excel

linq to excel exception IErrorInfo.GetDescription


This is my code

    var data = new LinqToExcel.ExcelQueryFactory();
                data.FileName = @"FRM_DTA.xlsx";                
                var result = from x in data.Worksheet<ExcelFileDefinition>()
                             select x;
Console.WriteLine(result.Count());

I got this exception:

OleDbException was unhandled

IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

on the console.write statement.

when I remove the console .write line, I got no exception


Solution

  • The problem was the file name being incorrect. Changing that solved the problem.