示例#1
0
 public void RefreshdataGridView()//оновити табличку з бази даних
 {
     try
     {
         DataGridView1.Rows.Clear();
         WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1);
     }
     catch (Exception ex) { MessageBox.Show(ex.ToString()); }
 }
示例#2
0
        public void AddRowFromDataGridViewToDb()
        {
            AddRowForm addRowForm = new AddRowForm();

            addRowForm.ShowDialog();
            if (AddRowForm.AddRowOK)
            {
                DataGridView1.Rows.Clear();
                WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1);
            }
        }
示例#3
0
        public void OpenFormConnect()
        {
            ConnectToServerForm connectToServerForm = new ConnectToServerForm();

            connectToServerForm.ShowDialog();//показуємо форму для підключення
            if (ConnectToServerForm.ConnectOK)
            {
                connectToServerForm.Close();
                WorkWithDatabase.SelectAllToDataGridView(ref DataGridView1);//вибираємо всі дані
            }
            else
            {
                connectToServerForm.Close();
                Application.Exit();
            }
        }
示例#4
0
 private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     WorkWithDatabase.DeleteRowInDb(e, DataGridView1);
     RefreshdataGridView();
 }