private void button4_Click(object sender, EventArgs e) { ActiveForm.Hide(); EditProfileForm epf = new EditProfileForm(runnerId); epf.ShowDialog(); Close(); }
public EditProfileForm(int id) { InitializeComponent(); tm.Tick += timer1_Tick; tm.Interval = 1000; tm.Enabled = true; tm.Start(); rannerId = id; EditProfileForm epf = this; SqlConnClass scc = new SqlConnClass(); scc.GetEditRunnerProfile(epf, rannerId); }
public void GetEditRunnerProfile(EditProfileForm epf, int id) { string connStr = "server=localhost;user=root;database=pafenov;password="******"SELECT Email FROM runner WHERE RunnerId = " + id; MySqlCommand command = new MySqlCommand(sql, conn); epf.label14.Text = command.ExecuteScalar().ToString(); string sql1 = "SELECT DateOfBirth FROM runner WHERE RunnerID = " + id; command = new MySqlCommand(sql1, conn); DateTime dt = Convert.ToDateTime(command.ExecuteScalar()); epf.dateTimePicker1.Value = dt; string sql2 = "SELECT CountryName FROM country"; command = new MySqlCommand(sql2, conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { epf.comboBox2.Items.Add(reader[0].ToString()); } reader.Close(); string sql3 = "SELECT RunnerPhoto FROM runner WHERE RunnerId =" + id; command = new MySqlCommand(sql3, conn); string str = command.ExecuteScalar().ToString(); //epf.pictureBox1.Load(str); epf.textBox7.Text = str; string sql5 = "SELECT Gender FROM runner WHERE RunnerId = " + id; command = new MySqlCommand(sql5, conn); string gender = command.ExecuteScalar().ToString(); epf.comboBox1.SelectedItem = gender; string sql4 = "SELECT CountryName From runner JOIN country ON runner.CountryCode=country.CountryCode WHERE runner.RunnerId =" + id; command = new MySqlCommand(sql4, conn); string country = command.ExecuteScalar().ToString(); epf.comboBox2.SelectedItem = country; conn.Close(); }