When updating an Excel file using OLEDB from C# I get the error "Data type mismatch in criteria expression" if the original file has a hidden PrefixCharacter (apostrophe in my case). If I remove the apostrophe from the cells in the original file, my application works as expected and the data is updated without any errors. Any suggestions on how to remedy this problem other than manually removing the PrefixCharacter before processing the file?
Asked
Active
Viewed 1,942 times
1 Answers
0
A few months ago I was having problems with OLEDB/Excel automation as well: then I happened to find EPPlus http://epplus.codeplex.com/, and since then I haven't used OLEDB or Interop with Excel.
It doesn't require Excel to be installed, but it only works with the Open Office Xml format (xlsx), if that's not a limitation for you I would recommend it.
PS: I found it here on SO back in December when I was having similar (and other) issues with Excel Create Excel (.XLS and .XLSX) file from C#.