0

I'm trying to export some data to excel with special chars and more than 255 chars, its not getting inserted into the excel.

I'm working on 4.0 Framework with Office Interop.

OleDbDataAdapter dbadapter = null;
OleDbConnection excelConnection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + this.ProcessedFileName + "; Extended Properties=Excel 12.0" + ";Persist Security Info=False");
foreach (DataRow dr in dataTable.Rows)
{
      string sqlStquery = @"Insert into [Consumer$] ([Consumer Number],[Name],[Address1],[Address2],[City]) Values ('" + dr["Consumer Number"] + "','" + dr["Name"] + "','" + dr["Address1"] + "','" + dr["Address2"] + "','" + dr["City"] + "')";

      dbadapter = new OleDbDataAdapter(sqlStquery, excelConnection);
      dbadapter.SelectCommand.ExecuteNonQuery();
}
dbadapter.Dispose();
excelConnection.Close();
excelConnection.Dispose();

I am not able to find the solution.

Naveen Desosha
  • 347
  • 5
  • 12
  • possible duplicate of [Excel unable to insert more than 255 chars?](http://stackoverflow.com/questions/4488404/excel-unable-to-insert-more-than-255-chars) and [Export To Excel with Text more than 300 Characters not working](http://stackoverflow.com/questions/12052934/export-to-excel-with-text-more-than-300-characters-not-working) – Ramesh Rajendran Oct 24 '13 at 08:13
  • You can go through with below link which resolves your problem – Vishwajeet Kulkarni Oct 24 '13 at 07:46

0 Answers0