Ejemplo n.º 1
0
        private void changeButton_Click(object sender, EventArgs e)
        {
            AddMedicineUse form = new AddMedicineUse();

            string myQuery = "SELECT Название FROM Лекарства WHERE Код = " + Convert.ToInt32(dataGridView1.CurrentRow.Cells[2].Value);
            string s1      = GetStringValue(myQuery);

            form.SetBoxes(Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value),
                          s1,
                          Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value));

            form.ShowDialog();
            string s2 = form.GetUsage();
            string s3 = form.GetMedicine();

            myQuery = "SELECT Код FROM Лекарства WHERE [Название] = '" + s3 + "'";
            s3      = GetStringValue(myQuery);
            string s4 = form.GetPeriod();

            dataGridView1.CurrentRow.Cells[1].Value = s2;
            dataGridView1.CurrentRow.Cells[2].Value = s3;
            dataGridView1.CurrentRow.Cells[3].Value = s4;

            BindingSource bs = new BindingSource(ds, "НазначениеЛекарств");

            dataGridView1.DataSource = bs;
            UpdateGrid();
        }