asp.netsession:Asp.Net通过Session对象传递页面地址来源: 发布时间:星期六, 2009年3月28日 浏览:0次 评论:0
实现代码如下: using ; using .Data; using .Configuration; using .Collections; using .Web; using .Web.Security; using .Web.UI; using .Web.UI.WebControls; using .Web.UI.WebControls.WebParts; using .Web.UI.HtmlControls; using .Data.SqlClient ; public partial Item : .Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { (!IsPostBack) { DDLBind; } } protected SqlConnection GetConnection { conn = ConfigurationManager.AppSettings["ConnectionString"].; SqlConnection myConn = SqlConnection(conn); myConn; } protected void DDLBind { SqlConnection myConn = GetConnection; myConn.Open; sqlStr = "select * from Tb_Login where UId= " + Session["UId"]; SqlDataAdapter da = SqlDataAdapter(sqlStr, myConn); DataSet ds = DataSet; da.Fill(ds, "UserTable"); DataList1.DataSource = ds.Tables["UserTable"].DefaultView; DataList1.DataBind; } protected void Button1_Click(object sender, EventArgs e) { Session["address"] = null; Session["address"] = "Item.aspx"; Response.Redirect("register.aspx?addr="+Session["address"]. ); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Default.aspx"); } } 0
相关文章读者评论发表评论 |
|