using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class MemberMsg : System.Web.UI.Page { static string cinowo_id; static string nickname; static string cid; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["member"] != null) //登录用户信息 { DataTable dt = (DataTable)Session["member"]; Txtname.Text = dt.Rows[0]["nickname"].ToString(); cinowo_id = dt.Rows[0]["Cinowo_id"].ToString(); nickname = dt.Rows[0]["nickname"].ToString(); cid = dt.Rows[0]["Cid"].ToString(); } else { Methods1.Methods1.MsgBox("请登录!", "Login.aspx"); } //先查询出该登录会员的信息绑定在页面 string str = "select * from membertab where cid='" + cid + "'"; DataTable dts = DBH.DBHelper.GetDataSet(str); if (dts.Rows.Count > 0) { this.txtmail.Text = dts.Rows[0]["Cinowo_id"].ToString(); this.Txtname.Text = dts.Rows[0]["nickname"].ToString(); this.txtphone.Text = dts.Rows[0]["telephone"].ToString(); this.txtpostcode.Text = dts.Rows[0]["postcode"].ToString(); this.txtBirthday.Text = dts.Rows[0]["birthday"].ToString(); if (dts.Rows[0]["sex"].ToString() == "1") { this.rdSex.Text = "1"; } else { this.rdSex.Text = "2"; } this.txtqs.Text = dts.Rows[0]["QS"].ToString(); this.txtXM.Text = dts.Rows[0]["names"].ToString(); this.txtans.Text = dts.Rows[0]["ans"].ToString(); this.txtadress.Text = dts.Rows[0]["address"].ToString(); } } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string sql = "update membertab set cinowo_id='" + txtmail.Text + "' , sex='" + rdSex.Text + "' , nickname='" + Txtname.Text + "', address='" + txtadress.Text + "', names='" + txtXM.Text + "', birthday='" + txtBirthday.Text + "' , postcode='" + txtpostcode.Text + "', telephone='" + txtphone.Text + "', QS='" + txtqs.Text + "',ans='" + txtans.Text + "' where cid='" + cid + "'"; int i = DBH.DBHelper.ExecuteNonQuery(sql); if (i > 0) { Session.Clear(); Methods1.Methods1.MsgBox("修改成功,修改后的资料将在下次登录时显示!", "MemberMsg.aspx"); } else { Methods1.Methods1.MsgBox("信息修改失败!", "MemberMsg.aspx"); } } }