private void select_dop_rekvisit_edit_Load(object sender, EventArgs e) { edit_zadan_plat edit_zadan_plat = (edit_zadan_plat)this.Owner; SqlCommand command = new SqlCommand("select CATALOG_KONTRAGENT.NAIMENOVAN_KONTR, CATALOG_KONTRAGENT_DOP_REKVISIT.INN, CATALOG_KONTRAGENT_DOP_REKVISIT.KPP, CATALOG_KONTRAGENT_DOP_REKVISIT.ACCOUNT, CATALOG_KONTRAGENT_DOP_REKVISIT.BANK_NAIMENOVAN,CATALOG_KONTRAGENT_DOP_REKVISIT.BIK, CATALOG_KONTRAGENT_DOP_REKVISIT.KORR_COUNT from CATALOG_KONTRAGENT_DOP_REKVISIT, CATALOG_KONTRAGENT where [CATALOG_KONTRAGENT].ID=CATALOG_KONTRAGENT_DOP_REKVISIT.ID_CATALOG_KONTRAGENT and CATALOG_KONTRAGENT.INN='" + edit_zadan_plat.rekv + "'", conn); SqlDataAdapter da = new SqlDataAdapter(command);//Переменная объявлена как глобальная SqlCommandBuilder cb = new SqlCommandBuilder(da); DataSet ds = new DataSet(); conn.Close(); //Заполнение DataGridView наименованиями полей da.Fill(ds, "CATALOG_KONTRAGENT_DOP_REKVISIT"); dataGridView1.DataSource = ds.Tables[0]; fill_gridview(); }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { edit_zadan_plat edit_zadan_plat = (edit_zadan_plat)this.Owner; edit_zadan_plat.comboBox2.Text = ""; edit_zadan_plat.comboBox2.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); edit_zadan_plat.comboBox7.Text = ""; edit_zadan_plat.comboBox7.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); edit_zadan_plat.textBox8.Clear(); edit_zadan_plat.textBox8.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); edit_zadan_plat.textBox9.Clear(); edit_zadan_plat.textBox9.Text = dataGridView1.CurrentRow.Cells[3].Value.ToString(); edit_zadan_plat.textBox10.Clear(); edit_zadan_plat.textBox10.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString(); edit_zadan_plat.textBox11.Clear(); edit_zadan_plat.textBox11.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString(); edit_zadan_plat.textBox12.Clear(); edit_zadan_plat.textBox12.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString(); this.Close(); }