SP blows on constraint violation 
Author Message
 SP blows on constraint violation

I call an SP which attempts to delete a row from a table whose primary
key is referenced as a foreign key in another table.

When I attempt to delete a row which has a reference in the foreign
table (cascade delete is off), the SP blows with message 547. So does
the execute method of the command object calling that SP.

Is there a way to trap that behavior in VB, so I can tell the user
that the deletion cannot be done? How should I handle this case?

Thanks - Larry



Tue, 07 Sep 2004 11:01:43 GMT  
 SP blows on constraint violation
Check for this error number....
On Error Resume Next
    .Execute
If Err.Number = violationconstraint Then

End iF
...


Quote:
> I call an SP which attempts to delete a row from a table whose primary
> key is referenced as a foreign key in another table.

> When I attempt to delete a row which has a reference in the foreign
> table (cascade delete is off), the SP blows with message 547. So does
> the execute method of the command object calling that SP.

> Is there a way to trap that behavior in VB, so I can tell the user
> that the deletion cannot be done? How should I handle this case?

> Thanks - Larry



Tue, 07 Sep 2004 17:54:42 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL to Find Referencial Constraint Violations?

2. Foreign Constraints violation in Shaped RS

3. A constraint violation occurred

4. OCX Missing Properties on VB 6 SP 4 or SP 5

5. 'Syntax error or access violation' when trying to execute an Oracle SP?

6. I blew up my menus - Help!!

7. Reports Blowing Up

8. Docmd.TransferDatabase acImport blows my functions away?

9. Blowing GetChunk s

10. Access 97 Blowing Up on Export (VBA)

11. Word Automation Program Blowing Up

12. Macro Blows up After being Emailed

 

 
Powered by phpBB® Forum Software