I'm trying to update a column, which is a foreign key, I'm trying to set it to a "NULL" value but the error says "ERROR 1452: Cannot add or update a child row: a foreign key constraint fails. "
try
 {  
    con.Open();
    MySqlCommand cmd = new MySqlCommand(
                "UPDATE tblcdsummary 
                    set PersonalInfoID = '" + DBNull.Value.ToString() + 
                    "' WHERE CDID = '" + looplabel2.Text + "'", con);
    cmd.ExecuteNonQuery();
    con.Close();
}
catch (Exception x)
{
    MessageBox.Show(x.Message);
}
 
     
     
     
    