private void ChooseModelModifCB_SelectedIndexChanged(object sender, System.EventArgs e) { СhooseMarkModifCB.Items.Clear(); string sqlExpression = "SELECT Mark_auto FROM Automobile Where Model_auto = '" + ChooseModelModifCB.Text + "'"; CBquery(sqlExpression, СhooseMarkModifCB); if (!Model) { ++countChosenauto; Model = true; } if (countChosenauto == 2) { countChosenauto = 0; ColorModif.Show(); EngineModif.Show(); ComplectationModif.Show(); YearModif.Show(); YearTB.Show(); Pricelbl.Show(); PriceTB.Show(); ModifButton.Show(); ColorModifCB.Show(); sqlExpression = "SELECT Colour FROM Automobile_colour Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')"; CBquery(sqlExpression, ColorModifCB); SpecsModifCB.Show(); sqlExpression = "SELECT Engine_type FROM Automobile_Specification Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')"; CBquery(sqlExpression, SpecsModifCB); ComplectModifCB.Show(); sqlExpression = "SELECT Equipment FROM Automobile_Complectation Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')"; CBquery(sqlExpression, ComplectModifCB); Model = false; } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { String name = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); String category = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); int price = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString()); ItemTxtLb.Text = name; CategoryTB.Text = category; PriceTB.Text = price.ToString(); PriceTB.Show(); CategoryTB.Show(); } catch { } }