public void RefreshdataGridView()//оновити табличку з бази даних { try { DataGridView1.Rows.Clear(); WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void AddRowFromDataGridViewToDb() { AddRowForm addRowForm = new AddRowForm(); addRowForm.ShowDialog(); if (AddRowForm.AddRowOK) { DataGridView1.Rows.Clear(); WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1); } }
public void OpenFormConnect() { ConnectToServerForm connectToServerForm = new ConnectToServerForm(); connectToServerForm.ShowDialog();//показуємо форму для підключення if (ConnectToServerForm.ConnectOK) { connectToServerForm.Close(); WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1);//вибираємо всі дані } else { connectToServerForm.Close(); Application.Exit(); } }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { WorkWithDatabase.DeleteRowInDb(e, DataGridView1); RefreshdataGridView(); }