我的思路:先从登陆页面把用户名传过来,然后根据用户名在表中查找,把该用户的信息调出来显示在页面上
Label10.Text=Session["name"].ToString();
SqlConnection conn = sc.getSqlConnection();
conn.Open();
string sql1 = "select * from XX where Name=" + Session["name"] + "";
SqlCommand comm = new SqlCommand(sql1, conn);
DataSet ds = new DataSet();
SqlDataReader dr = comm.ExecuteReader();
if (dr.Read())
{
this.Label11.Text = dr.GetString(dr.GetOrdinal("Nicename"));
this.Label12.Text = dr.GetString(dr.GetOrdinal("Sex"));
this.Label13.Text = dr.GetString(dr.GetOrdinal("PhoneNumber"));
this.Label14.Text = dr.GetString(dr.GetOrdinal("Email"));
}
dr.Close();
conn.Close();
请大神们帮忙看看错在哪,或者思路不对 请大家告诉我该怎么做。
谢谢了