Example #1
0
 private void delstu_Click(object sender, EventArgs e)
 {
     if (dataGridstudent.SelectedCells.Count != 0)
     {
         int        rw    = dataGridstudent.SelectedCells[0].RowIndex;
         string     cmd   = string.Format("DELETE FROM Student where Id = '{0}'", dataGridstudent.Rows[rw].Cells["Id"].Value.ToString());
         SqlCommand del   = new SqlCommand(cmd, DatabaseConnection.getInstance().getConnection());
         int        count = del.ExecuteNonQuery();
         students   s     = new students();
         this.Hide();
         s.Show();
     }
 }