Exemplo n.º 1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            CharitySponsor chaspo = new CharitySponsor();
            int            index  = comboBox1.Text.IndexOf("-") - 1;

            s = comboBox1.Text.Substring(0, index);
            SqlDataReader sqlread;
            SqlCommand    select = new SqlCommand("select Registration.RegistrationId,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)
                {
                    label13.Text = sqlread["CharityName"].ToString();
                    ID           = Convert.ToInt16(sqlread["RegistrationId"]);
                }
            }

            sqlread.Close();
        }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
            }
        }