顯示用戶信息:(show_user_info)

private void Page_Load(object sender, System.EventArgs e)

         {

              // 在此處放置用戶代碼以初始化頁面

              if(!Page.IsPostBack)

              {

                   this.HyperLink1.NavigateUrl="modify_pwd.aspx?id="+Request.QueryString["id"];

                  SqlConnection  con=new SqlConnection();

                   con.ConnectionString=ConfigurationSettings.AppSettings["ConnectionString"];

                   SqlCommand cmd=new SqlCommand();

                   cmd.CommandText="select user_name,user_kind,user_sex,user_birthday,user_email from user_info where user_id= '"+Request.QueryString["id"]+"'";

                   cmd.Connection=con;

                   con.Open();

                   SqlDataReader reader=cmd.ExecuteReader();

                  if(reader.Read())

                   {

                       if(Convert.ToInt32(reader["user_sex"])==0)

                            sex="";

                       else

                            sex="";

 

 

 

                   lblbirthday.Text=Convert.ToDateTime(reader["user_birthday"]).ToString("D");

                   lblusername.Text=Convert.ToString(reader["user_name"]);

                   lbluserkind.Text=Convert.ToString(reader["user_kind"]);

                  

                   lbluseremail.Text=Convert.ToString(reader["user_email"]);

                   lblsex.Text=Convert.ToString(sex);

                   }

                   Page.DataBind();

                   reader.Close();

                   con.Close();

              }

         }

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章