asp.Net数据导出问题 急急急
菠萝帅帅的 2011-01-09 11:32:06 因为数据量比较大 我已经超出了excle的上限 怎么才能导出到几个excle文件呢?谢谢大家了
我的代码是这样写的 但是没有循环呀
//待判断数据是否没有超出excle的上限65535
StringWriter sw = new StringWriter();
sw.WriteLine("订单号" + "\t" + "终端号" + "\t" + "状态" + "\t" + "电话" + "\t" + "价格" + "\t" + "成本" + "\t" + "创建时间");
int Tick = TANUM.Rows.Count / 65535;
for (int i = 0; i <= Tick; i++)
{
DataTable dt = TongLu.DatasInfo.DataLayer.DBHelper.CashPhone_OrderForm.Select(this.Key, EndNum * i + 1, EndNum * (i + 1));
foreach (DataRow dr in dt.Rows)
{
string Status = (int)dr["Status"] == 2 ? "成功" : (int)dr["Status"] == 1 ? "部分成功" : (int)dr["Status"] == 4 ? "失败" : "发货中";
sw.WriteLine(dr["FormCode"] + "\t" + dr["ClientID"] + "\t" + Status + "\t" + dr["Phone"] + "\t" + dr["Price"] + "\t" + dr["Cost"] + "\t" + dr["CreateTime"]);
}
sw.Close();
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("Data", System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/ms-excel";
Response.Output.Write(sw.ToString());
Response.End();
}