void updateBoxes() { DbClients dbc = new DbClients(); int ClientId = int.Parse(comboBox2.Text); textBox6.Text = (string)dbc.GetClientInfo(ClientId).Tables[0].Rows[0]["FirstName"]; //textBox6.Text = dbc.GetClientInfo(2).Tables[0].Columns[0].Table.ToString(); //textBox7.Text=dbc.GetClientInfo(2).Tables[0].Columns[0].Table.ToString(); DbCars dbca = new DbCars(); if (comboBox4.Text != "") { int carId = int.Parse(comboBox4.Text); textBox4.Text = (string)dbca.getCarInfo(carId).Tables[0].Rows[0]["Kind"]; } DbWorker dbw = new DbWorker(); if (comboBox3.Text != "") { int wId = int.Parse(comboBox3.Text); textBox7.Text = (string)dbw.getWorkerInfo(wId).Tables[0].Rows[0]["FirstName"]; } }
private void button3_Click(object sender, EventArgs e) { WindowsFormsApplication1.Car w = new WindowsFormsApplication1.Car(); DbCars db = new DbCars(); DataSet ds = new DataSet(); try { w.Id = int.Parse(textBox1.Text); if (db.CarExist(w.Id) == true) { ds = db.getCarInfo(w); textBox1.Text = ds.Tables[0].Rows[0]["ProductCode"].ToString(); textBox3.Text = ds.Tables[0].Rows[0]["Kind"].ToString(); textBox2.Text = ds.Tables[0].Rows[0]["Color"].ToString(); textBox4.Text = ds.Tables[0].Rows[0]["ClientId"].ToString(); textBox5.Text = ds.Tables[0].Rows[0]["History"].ToString(); } else { textBox1.Text = "Car not found "; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }