//输出excel文件,保存文件名为"导出+时间"
SqlConnection conn = DBLink.GetConnection();
conn.Open();
SqlCommand cmd = new SqlCommand(@"select *from placeList order by date asc,dateTime asc", conn);
cmd.Connection = conn;
SqlDataReader sqlreader = cmd.ExecuteReader();
Repeater1.DataSource = sqlreader;
Repeater1.DataBind();
conn.Close();
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
this.exportRpt.RenderControl(hw);
DateTime newDate = DateTime.Now.Date;
string exportFile = "导出" + newDate.Year.ToString() + "" + newDate.Month.ToString() + "" + newDate.Day.ToString() + "";
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Repeater2.EnableViewState = true;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(exportFile, System.Text.Encoding.UTF8) + ".xls");
Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"><title>Copyright by SDU</title></head><body><table><tr><td>");
Response.Write(sw.ToString());
Response.Write("</td></tr></table></body></html>");
Response.End();
SqlConnection conn = DBLink.GetConnection();
conn.Open();
SqlCommand cmd = new SqlCommand(@"select *from placeList order by date asc,dateTime asc", conn);
cmd.Connection = conn;
SqlDataReader sqlreader = cmd.ExecuteReader();
Repeater1.DataSource = sqlreader;
Repeater1.DataBind();
conn.Close();
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
this.exportRpt.RenderControl(hw);
DateTime newDate = DateTime.Now.Date;
string exportFile = "导出" + newDate.Year.ToString() + "" + newDate.Month.ToString() + "" + newDate.Day.ToString() + "";
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Repeater2.EnableViewState = true;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(exportFile, System.Text.Encoding.UTF8) + ".xls");
Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"><title>Copyright by SDU</title></head><body><table><tr><td>");
Response.Write(sw.ToString());
Response.Write("</td></tr></table></body></html>");
Response.End();