private void Login_form_Load(object sender, EventArgs e) { using (conn = new SqlConnection(ConnectionString)) { User_profile_form profile = new User_profile_form(); profile.email_lbl.Text = email_txt.Text; } }
/* * public void Load_basic_info() * { * int user_id = 0; * using (conn = new SqlConnection(ConnectionString)) * { * try * { * conn.Open(); * * string Query = "select * FROM user_registration_tbl WHERE email = @email"; * cmd = new SqlCommand(Query, conn); * * cmd.Parameters.AddWithValue("@email", "*****@*****.**"); * SqlDataReader dr = cmd.ExecuteReader(); * while (dr.Read()) * { * user_id = Convert.ToInt32(dr["user_id"]); * * } * * User_profile_form profile = new User_profile_form(); * profile.OverDues(user_id, dues_grid_view); * } * catch (Exception ex) * { * * MessageBox.Show(ex.Message); * } * } * }*/ public void Load_basic_info() { int user_id = 0; using (conn = new SqlConnection(ConnectionString)) { try { conn.Open(); string Query = "select * FROM user_registration_tbl WHERE email = @email"; cmd = new SqlCommand(Query, conn); if (login_form.getemail != null) { cmd.Parameters.AddWithValue("@email", login_form.getemail); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { user_id = Convert.ToInt32(dr["user_id"]); } } else { cmd.Parameters.AddWithValue("@email", Registration_form.getemail); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { user_id = Convert.ToInt32(dr["user_id"]); } } User_profile_form profile = new User_profile_form(); profile.OverDues(user_id, dues_grid_view); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }