Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form16 f = new Form16();

            this.Hide();
            f.ShowDialog();
            Close();
        }
Exemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            int    index, n;
            string SqlText = "UPDATE [Marshrut] SET ";
            string MarshrutID, Kudy, Opys;

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

            Form16 f = new Form16();

            // заповнити форму даними перед відкриттям
            index      = dataGridView1.CurrentRow.Index;
            MarshrutID = dataGridView1[0, index].Value.ToString();
            Kudy       = dataGridView1[1, index].Value.ToString();
            Opys       = dataGridView1[2, index].Value.ToString();

            f.textBox2.Text = Kudy;
            f.textBox3.Text = Opys;


            if (f.ShowDialog() == DialogResult.OK)
            {
                Kudy = f.textBox2.Text;
                Opys = f.textBox3.Text;

                SqlText += "Kudy = \'" + Kudy + "\', Opys = '" + Opys + "";
                SqlText += "WHERE [Marshrut].MarshrutID = " + MarshrutID;
                MyExecuteNonQuery(SqlText);
                Marshrut();
            }
        }