- Joe Hess
- PowerBuilder
- Friday, 15 October 2021 08:02 PM UTC
Hi,
I'm trying to capture a thrown error from a delete trigger while using a datastore. The datastore seems to ignore it.
The trigger is simple:
IF EXISTS (SELECT 1 FROM table, deleted WHERE table.key=deleted.key) THROW 60000, 'Record may not be deleted.', 1
If I attempt to delete the record using a statement in SSMS, the error is thrown properly. If I use an SQL DELETE statement in PowerScript, I can see/capture the error information in SQLCA. However, if I try to use ds.Delete(row) followed by ds.Update(), the error does not appear. There is nothing in SQLCA. The DBError event does not fire. I tried wrapping the update with TRY - CATCH. Nothing seems to work. The record does not delete as it shouldn't. I just have no message that the delete failed.
Is this possible, or do I need to stick with using the delete statement in PowerScript?
Thanks,
Joe
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.