110,539
社区成员
发帖
与我相关
我的任务
分享
//查询数据库,返回DataTable
System.Data.DataTable dt = LogicLayer_AMonitorDataInfo.GetDataTable(dataInfo);
StringWriter sw = new StringWriter();
foreach (DataRow dr in dt.Rows)
{
sw.WriteLine(dr["数据编号"] + "\t" + dr["站点名称"]
}
sw.Close();
Response.AddHeader("Content-Disposition", "attachment; filename=AMonitorData.xls");
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.Clear();
Response.Write(sw);
Response.Buffer = true;
Response.Flush();
//Response.End();