我需要在Excel中导出1000000条记录,但是由于内存错误 [英] i need to export 1000000 records in excel but it gives error outof memmory
本文介绍了我需要在Excel中导出1000000条记录,但是由于内存错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我需要在excel中导出1000000条记录,但它会发出内存不足的异常.
请找到以下我在导出记录中使用的代码,该代码在3.5缺少记录的情况下效果很好
Dear,
I need to export 1000000 records in excel but it gives out of memory exception.
Please find the below code which I used in the exporting record it works well for 3.5 lacks record
Response.ContentType = "application/vnd.ms-excel";
string FileName = "PoliciesDetailsForBranch";
Response.AppendHeader("content-disposition", "attachment; filename=" + FileName + ".xls");
GridView gv = new GridView();
this.EnableViewState = false;
gv.DataSource = (DataTable)dt;
gv.DataBind();
this.ClearControls(gv);
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(Response.Output);
gv.RenderControl(hw);
Response.End();
请帮助我解决此问题.
Please help me to overcome with this issue.
推荐答案
代码项目站点上已经给出了一个很好的示例,说明如何将数据导出到多个Excel工作表.
将数据集导出到多个Excel工作表
A good example already given on codeproject site, how to export data to multiple excel sheet.
Export DataSet to Multiple Excel Sheets
这篇关于我需要在Excel中导出1000000条记录,但是由于内存错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文