使用C#将大数据导出为多张表

我需要将6'00'000 +logging数据表导出为ex​​cel。 我试着用下面的代码, 但我得到了OutOfMemory exception 。 现在我想将所有这些logging导出到多个工作表而不是单个工作表来克服这个错误。

这里是我的代码导出数据到Excel中。

  private void ExportDataToExcel(DataTable Tbl) { Response.Clear(); Response.ClearContent(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=PeriodicJobEvents.xls"); GridView excel = new GridView(); excel.DataSource = Tbl; excel.DataBind(); excel.RenderControl(new HtmlTextWriter(Response.Output)); Response.Flush(); Response.End(); } 

请帮助我了解如何将6'00'000 +logging导出到多个表单。