private void gunaButton8_Click(object sender, EventArgs e) { NewCouch newCouch = new NewCouch(); DialogResult dialogResult = new DialogResult(); dialogResult = newCouch.ShowDialog(); UpdateCouch(); }
private void gunaButton9_Click(object sender, EventArgs e) { connection = new SqlConnection(connectionString); connection.Open(); int index = 0; foreach (DataGridViewCell cell in AllDataGridView.SelectedCells) { index = cell.RowIndex; } string a = (AllDataGridView[0, index].Value.ToString()); string b = (AllDataGridView[1, index].Value.ToString()); string c = (AllDataGridView[2, index].Value.ToString()); string d = (AllDataGridView[5, index].Value.ToString()); string ee = (AllDataGridView[6, index].Value.ToString()); string f = (AllDataGridView[8, index].Value.ToString()); string g = (AllDataGridView[9, index].Value.ToString()); string h = (AllDataGridView[3, index].Value.ToString()); int i = Convert.ToInt32((AllDataGridView[4, index].Value)); int ll = Convert.ToInt32((AllDataGridView[7, index].Value)); DateTime date = Convert.ToDateTime((AllDataGridView[10, index].Value)); int index1 = 0; foreach (DataGridViewCell cell in AllDataGridView.SelectedCells) { index1 = cell.RowIndex; } string query = $"select * from [user] join couch on [User].ID_user=couch.Id_user"; AllDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; AllDataGridView.AllowUserToAddRows = false; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); adapter = new SqlDataAdapter(query, connection); dataSet = new DataSet(); adapter.Fill(dataSet); AllDataGridView.DataSource = dataSet.Tables[0]; connection.Close(); } connection = new SqlConnection(connectionString); connection.Open(); string choose_id = (AllDataGridView[0, index1].Value.ToString()); UpdateCouch(); NewCouch newCouch = new NewCouch(Convert.ToInt32(choose_id), a, b, c, d, ee, f, g, date, h, i, ll); DialogResult dialogResult = new DialogResult(); dialogResult = newCouch.ShowDialog(); UpdateCouch(); }