Hello
It doesn't delete because the condition returns false. Check the purpose if it's correct then you must check the dat. If all of these are correct then try this:
sqlQuery = "delete from tblstaffsalarypaymentdetails where purpose = N'" + purpose + "' and dateofpayment ='" + dat + "'";
Some advises:
1. Do not use
conn.Close()
after a query because if there be an exception before than
conn.Close
then the connection never be closed.
Use it in a
finally
block. or use
using
2. The code dosn't need
else
:
if (MessageBox.Show("Are you really sure of the deletion", "Deletion", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
person5.ID5 = this.cboStaffid5.Text;
person5.removeRegister5();