private void bDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         try
         {
             ClassData classData = new ClassData();
             classData.deleteMahasiswa(tNIM.Text);
             dataGridView1.DataSource = classData.getAllData();
             MessageBox.Show("Data successfuly deleted");
         }
         catch (Exception ex)
         {
             //  label7.Text = "Server Error";
         }
     }
 }
        private void bUpdate_Click(object sender, EventArgs e)
        {
            if (tNIM.Text != "" &&
                TNama.Text != "" &&
                TProdi.Text != "" &&
                TAngkatan.Text != "")
            {
                if (tNIM.Text.Length <= 12 &&
                    TAngkatan.Text.Length <= 4 &&
                    TProdi.Text.Length <= 30 &&
                    TNama.Text.Length <= 20)
                {
                    try
                    {
                        Mahasiswa mhs = new Mahasiswa();
                        mhs.nim      = tNIM.Text;
                        mhs.nama     = TNama.Text;
                        mhs.prodi    = TProdi.Text;
                        mhs.angkatan = TAngkatan.Text;

                        ClassData classData = new ClassData();
                        classData.updateDatabase(mhs);
                        MessageBox.Show("Data successfuly updated");

                        dataGridView1.DataSource = classData.getAllData();
                    }
                    catch
                    {
                        // label7.Text = "Server Error";
                    }
                }
                else
                {
                    MessageBox.Show("Please check your data");
                }
            }
            else
            {
                MessageBox.Show("Please check your data");
            }
        }