?? querywarehousenowprint.aspx.cs
字號:
?//文件名:QueryWarehouseNowPrint.aspx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class GoodsManage_QueryWarehouseNowPrint : System.Web.UI.Page
{
private GoodsManage_QueryWarehouseNowForm MyPrintForm;
protected void Page_Load(object sender, EventArgs e)
{//將查詢結果輸出到Excel文件中
MyPrintForm = (GoodsManage_QueryWarehouseNowForm)Context.Handler;
string MySQL = MyPrintForm.MyPrintSQL;
this.Label1.Text = MyPrintForm.MyPrintTitle;
this.Label2.Text = MyPrintForm.MyPrintDate;
string MyConnectionString = ConfigurationManager.ConnectionStrings["MySaleDBConnectionString"].ConnectionString; ;
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnectionString);
DataSet MySet = new DataSet();
MyAdapter.Fill(MySet);
this.DataGrid1.DataSource = MySet;
this.DataGrid1.DataBind();
this.Response.ContentType = "application/vnd.ms-excel";
this.Response.Charset = "";
//關閉 ViewState
this.EnableViewState = false;
System.IO.StringWriter MyWriter;
System.Web.UI.HtmlTextWriter MyWeb;
//將信息寫入字符串
MyWriter = new System.IO.StringWriter();
//在Web窗體頁上寫出一系列連續(xù)的HTML特定字符和文本
MyWeb = new System.Web.UI.HtmlTextWriter(MyWriter);
//將DataGrid中的內容輸出到HtmlTextWriter對象中
this.DataGrid1.RenderControl(MyWeb);
//把HTML寫回瀏覽器
Response.Write(MyWriter.ToString());
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -