예제 #1
0
파일: Form1.cs 프로젝트: o2valente/BD
        public void GetInfoJogo(int nrJogo, InfoJogo form)
        {
            form.setNumber(nrJogo);
            CN.Open();
            SqlCommand cmd = new SqlCommand("PROJETO.infoJogo", CN);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@nr", nrJogo));
            SqlDataReader reader = cmd.ExecuteReader();

            form.getList().Items.Clear();
            while (reader.Read())
            {
                form.getList().Items.Add("Arbitro Principal: " + reader["a"]);
                form.getList().Items.Add("Arbitro Linha: " + reader["al1"]);
                form.getList().Items.Add("Arbitro Linha: " + reader["al2"]);
                form.getList().Items.Add("Quarto Arbitro: " + reader["qa"]);
                form.getList().Items.Add("Estadio: " + reader["estadio"]);
                form.getList().Items.Add("Numero Espetadores: " + reader["espetadores"]);
            }
            CN.Close();
        }
예제 #2
0
파일: Form1.cs 프로젝트: o2valente/BD
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedItem == null)
            {
                return;
            }
            string sel = listBox1.SelectedItem.ToString();

            string[] vals   = sel.Split(':');
            int      nrJogo = Int32.Parse(vals[0]);

            CN.Open();
            SqlCommand cmd = new SqlCommand("PROJETO.infoJogo", CN);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@nr", nrJogo));
            CN.Close();
            InfoJogo info = new InfoJogo();

            info.getLabel().Text = vals[1];
            GetInfoJogo(nrJogo, info);
            info.setForm1(this);
            info.Show();
        }