private void BtnExecuteSelectQuery_Click(object sender, EventArgs e)
 {
     myConnection = new MySqlConnection(connectionString);
     using (myDataAdapter = new MySqlDataAdapter(selectQuery, myConnection))
     {
         myCommandBuidler = new MySqlCommandBuilder(myDataAdapter);
         myTable          = new DataTable();
         myDataAdapter.Fill(myTable);
         DgvProducten.DataSource = myTable;
     }
     DgvProducten.ClearSelection();
     BtnRecordVerwijderen.Enabled = false;
     BtnRecordWijzigen.Enabled    = false;
 }
Пример #2
0
 private void BtnRecordToevoegen_Click(object sender, EventArgs e)
 {
     rowProductID = (int)DgvProducten.SelectedRows[0].Cells[0].Value;
     using (invulForm invulForm = new invulForm(this))
     {
         invulForm.Text = "MySQL Databasebeheer - record toevoegen";
         invulForm.RecordtitleLabel.Text = "record toevoegen";
         if (invulForm.ShowDialog() == DialogResult.OK)
         {
             myTable.Rows.Add(new Object[] { rowProductID + 1, productNaam, stock, beschikbaar });
             DgvProducten.Refresh();
             MessageBox.Show("Waarden in datagridview gezet, druk op update om de database te synchronyseren", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Пример #3
0
 private void BtnExecuteSelectQuery_Click(object sender, EventArgs e)
 {
     using (myConnection = new MySqlConnection(connectionString))
     {
         myConnection.Open();
         myDataAdapter    = new MySqlDataAdapter(selectQuery, myConnection);
         myCommandBuidler = new MySqlCommandBuilder(myDataAdapter);
         using (myTable = new DataTable())
         {
             myDataAdapter.Fill(myTable);
             DgvProducten.DataSource = myTable;
             DgvProducten.ClearSelection();
         }
     }
 }
Пример #4
0
        private void BtnRecordWijzigen_Click(object sender, EventArgs e)
        {
            rowProductID = (int)DgvProducten.SelectedRows[0].Cells[0].Value;
            using (invulForm invulForm = new invulForm(this))
            {
                if (invulForm.ShowDialog() == DialogResult.OK)
                {
                    myTable.Rows[rowProductID - 1]["productNaam"]  = productNaam;
                    myTable.Rows[rowProductID - 1]["productStock"] = stock;
                    myTable.Rows[rowProductID - 1]["beschikbaar"]  = beschikbaar;
                    DgvProducten.Refresh();

                    MessageBox.Show("Waarden in datagridview gezet, druk op update om de database te synchronyseren", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }