温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.net房产中介管理系统源码及常用文档
当前文件路径:HouseManage/ClientManage/QueryClientLeasePrint.aspx.cs

1//文件名:QueryClientLeasePrint.aspx.cs 2
using System; 3
using System.Data; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
//该源码下载自www.51aspx.com(51aspx.com) 13
14
using System.Data.SqlClient; 15
public partial class ClientManage_QueryClientLeasePrint : System.Web.UI.Page 16
{ 17
private ClientManage_QueryClientLeaseForm MyPrintForm; 18
protected void Page_Load(object sender, EventArgs e) 19
{//将查询结果输出到Excel文件中 20
MyPrintForm = (ClientManage_QueryClientLeaseForm)Context.Handler; 21
string MySQL = MyPrintForm.MyPrintSQL; 22
this.Label1.Text = Session["MyCompanyName"].ToString() + "求租客源查询结果表"; 23
this.Label2.Text = MyPrintForm.MyPrintDate; 24
string MyConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString; ; 25
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnectionString); 26
DataSet MySet = new DataSet(); 27
MyAdapter.Fill(MySet); 28
this.DataGrid1.DataSource = MySet; 29
this.DataGrid1.DataBind(); 30
this.Response.ContentType = "application/vnd.ms-excel"; 31
this.Response.Charset = ""; 32
this.EnableViewState = false; 33
System.IO.StringWriter MyWriter; 34
System.Web.UI.HtmlTextWriter MyWeb; 35
MyWriter = new System.IO.StringWriter(); 36
MyWeb = new System.Web.UI.HtmlTextWriter(MyWriter); 37
this.DataGrid1.RenderControl(MyWeb); 38
Response.Write(MyWriter.ToString()); 39
} 40
} 41





}
}