protected void Page_Load(object sender, EventArgs e) { pop p = new pop(); hocsinh hs = p.show(s); name.Text = hs.StudentName; addr.Text = hs.address; dob.Text = hs.dateOfbirth.ToShortDateString(); phonenumb.Text = hs.phone; mail.Text = hs.email; }
public hocsinh show(string id) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Select * From Profile Where rollNumber = '" + id + "'"; SqlDataReader reader = cmd.ExecuteReader(); hocsinh hs = new hocsinh(); while (reader.Read()) { hs.StudentName = (string)reader["StudentName"]; hs.email = (string)reader["email"]; hs.phone = (string)reader["phone"]; hs.dateOfbirth = (DateTime)reader["dateOfbirth"]; hs.address = (string)reader["address"]; } return(hs); }