I am trying to export some data to Excel. I am using OLEDB 12. The connectio string looks like:
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES;'"
And I use an INSERT query. But whenever the data in a target column exceeds 255 chars, I get an exception.
Exception Details: System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.
There is a similar post on SO: Excel unable to insert more than 255 chars? but it is not into c#,
I also referred to http://support.microsoft.com/kb/213841 and not getting any solution.
Please help.
What I did finally:
As I could no amass enough responses and was not able to solve the issue, I switched to Excel object (Office Interop) and there is no issue now.