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

时间:2015-05-08 05:45:44

标签: excel c#-4.0 export

我需要将6&00; 00' 000+记录的数据表导出到excel中。 我尝试使用下面的代码, ,但我得到的是OutOfMemory exception 。现在我想把所有这些记录导出到多张表而不是单张表来克服这个错误。

以下是将数据导出到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; 00' 000+记录导出为多张。

0 个答案:

没有答案
相关问题