You might do the delete inside a transaction:
try
{
begin transaction
delete row
}
catch SQLException
{
if SQL error indicates referential integrity violation
throw ReferentialIntegrityViolationException
}
finally
{
rollback transaction
}
(assuming you never want the delete to take place at this point in your code)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…