Exit()
{
string path = Server.MapPath("~/UpLoadPicture/");
DateTime now = DateTime.Now;
String fileName = now.Year.ToString() + now.Month.ToString() + now.Day.ToString() + now.Hour.ToString() + now.Minute.ToString() + now.Second.ToString() + ".xls";
FileStream fs = new FileStream(path + fileName, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("gb2312"));
DataSet ds = Dal.GetAll();
sw.WriteLine("名称/t编码/tRemark");
foreach (DataRow dr in ds.Tables[0].Rows)
{
sw.WriteLine(dr["Name"] + "/t" + dr["Code"] + "/t" + dr["Remark"]);
}
sw.Close();
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(path + fileName));
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = "application/ms-excel";
Response.WriteFile(path + fileName);
Response.Flush();
Response.Close();
Response.End();
}