private void button4_Click(object sender, EventArgs e)
        {
            int    index, n;
            string SqlText = "UPDATE [Pasagir] SET ";
            string ID_Pasagir, Surname, Name, NomerTelefony, Pasport, TicketsID, ReysID;

            // перевірка, чи є взагалі записи в таблиці Source
            n = dataGridView1.Rows.Count;
            if (n == 1)
            {
                return;
            }

            Form19 f = new Form19();

            // заповнити форму даними перед відкриттям
            index         = dataGridView1.CurrentRow.Index;
            ID_Pasagir    = dataGridView1[0, index].Value.ToString();
            Surname       = dataGridView1[0, index].Value.ToString();
            Name          = dataGridView1[1, index].Value.ToString();
            NomerTelefony = dataGridView1[2, index].Value.ToString();
            Pasport       = dataGridView1[2, index].Value.ToString();
            TicketsID     = dataGridView1[2, index].Value.ToString();
            ReysID        = dataGridView1[2, index].Value.ToString();

            f.textBox1.Text = Surname;
            f.textBox2.Text = Name;
            f.textBox3.Text = NomerTelefony;
            f.textBox4.Text = Pasport;
            f.textBox5.Text = TicketsID;
            f.textBox6.Text = ReysID;

            if (f.ShowDialog() == DialogResult.OK)
            {
                Surname       = f.textBox1.Text;
                Name          = f.textBox2.Text;
                NomerTelefony = f.textBox3.Text;
                Pasport       = f.textBox4.Text;
                TicketsID     = f.textBox5.Text;
                ReysID        = f.textBox5.Text;

                SqlText += "Surname = \'" + Surname + "\', Name = '" + Name + "\', NomerTelefony = '" + NomerTelefony + "\', Pasport = '" + Pasport + "\', TicketsID = '" + TicketsID + "', ReysID = '" + ReysID + "";
                SqlText += "WHERE [Reys].Reys_ID = " + ID_Pasagir;
                MyExecuteNonQuery(SqlText);
                Pasagir();
            }
        }
Example #2
0
File: 父窗口.cs Project: 77XX/X
 private void button1_Click(object sender, EventArgs e)
 {
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 0)
     {
         Form2 form2 = new Form2();
         this.Hide();
         form2.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 1)
     {
         Form3 form3 = new Form3();
         this.Hide();
         form3.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 2)
     {
         Form4 form4 = new Form4();
         this.Hide();
         form4.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 3)
     {
         Form5 form5 = new Form5();
         this.Hide();
         form5.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 4)
     {
         Form6 form6 = new Form6();
         this.Hide();
         form6.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 5)
     {
         Form7 form7 = new Form7();
         this.Hide();
         form7.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 6)
     {
         Form8 form8 = new Form8();
         this.Hide();
         form8.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 7)
     {
         Form9 form9 = new Form9();
         this.Hide();
         form9.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 8)
     {
         Form10 form10 = new Form10();
         this.Hide();
         form10.Show();
     }
     if (sexual.SelectedIndex == 0 && st.SelectedIndex == 9)
     {
         Form11 form11 = new Form11();
         this.Hide();
         form11.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 0)
     {
         Form12 form12 = new Form12();
         this.Hide();
         form12.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 1)
     {
         Form13 form13 = new Form13();
         this.Hide();
         form13.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 2)
     {
         Form14 form14 = new Form14();
         this.Hide();
         form14.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 3)
     {
         Form15 form15 = new Form15();
         this.Hide();
         form15.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 4)
     {
         Form16 form16 = new Form16();
         this.Hide();
         form16.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 5)
     {
         Form17 form17 = new Form17();
         this.Hide();
         form17.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 6)
     {
         Form18 form18 = new Form18();
         this.Hide();
         form18.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 7)
     {
         Form19 form19 = new Form19();
         this.Hide();
         form19.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 8)
     {
         Form20 form20 = new Form20();
         this.Hide();
         form20.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 9)
     {
         Form21 form21 = new Form21();
         this.Hide();
         form21.Show();
     }
     if (sexual.SelectedIndex == 1 && st.SelectedIndex == 10)
     {
         Form22 form22 = new Form22();
         this.Hide();
         form22.Show();
     }
 }