Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将超过255个字符和特殊字符导出到C中的excel单元格#_C#_Asp.net_Excel_.net 4.0_Export To Excel - Fatal编程技术网

C# 将超过255个字符和特殊字符导出到C中的excel单元格#

C# 将超过255个字符和特殊字符导出到C中的excel单元格#,c#,asp.net,excel,.net-4.0,export-to-excel,C#,Asp.net,Excel,.net 4.0,Export To Excel,我正在尝试将一些数据导出到excel,其中包含特殊字符和255个以上的字符,而不是插入excel 我正在使用Office Interop开发4.0框架 OleDbDataAdapter dbadapter = null; OleDbConnection excelConnection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + this.ProcessedFileName + "; Exten

我正在尝试将一些数据导出到excel,其中包含特殊字符和255个以上的字符,而不是插入excel

我正在使用Office Interop开发4.0框架

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();

我无法找到解决方案。

您可以通过下面的链接来解决您的问题,该链接可能会重复和