private void pictureBox1_Click(object sender, EventArgs e) { CharitySponsor chaspo = new CharitySponsor(); if (label13.Text != "") { SqlDataReader sqlread; SqlCommand select = new SqlCommand("select FirstName,LastName,Runner.RunnerId , Registration.CharityId,CharityName,CharityDescription,CharityLogo from [User] inner join Runner on[User].Email = Runner.Email inner join Registration on Registration.RunnerId = Runner.RunnerId inner join Charity on Charity.CharityId = Registration.CharityId", sqlconn); sqlread = select.ExecuteReader(); while (sqlread.Read()) { if (sqlread["FirstName"] + " " + sqlread["LastName"] == s) { chaspo.label1.Text = sqlread["CharityName"].ToString(); chaspo.textBox1.Text = sqlread["CharityDescription"].ToString(); // chaspo.pictureBox1.BackgroundImage = Image.FromFile(@"C:); label13.Text = sqlread["CharityName"].ToString(); } } sqlread.Close(); chaspo.Show(); } }
private void pictureBox1_Click(object sender, EventArgs e) { CharitySponsor chaspo = new CharitySponsor(); if (comboBox1.Text != "") { SqlDataReader sqlread; SqlCommand select = new SqlCommand("select CharityName,CharityLogo,CharityDescription from Charity", sqlconn); sqlread = select.ExecuteReader(); while (sqlread.Read()) { if (sqlread["CharityName"].ToString() == comboBox1.Text) { chaspo.label1.Text = sqlread["CharityName"].ToString(); chaspo.textBox1.Text = sqlread["CharityDescription"].ToString(); // chaspo.pictureBox1.BackgroundImage = Image.FromFile(@"C:); label13.Text = sqlread["CharityName"].ToString(); } } sqlread.Close(); chaspo.Show(); } }