In our business class we want the following functionality -
In the DELETE button click event, we first delete the oject by calling
WorkorderBusinessClass.DeleteWorkorder(int id)
Immediately after the method returns we want to check whether the delete was successful. But, as the method is static - we cannot return any value. We have set one property in the class 'boolen RecordsAffected' which can hold how many records were affected by the last query. But as the Delete method is static, we cannot set the value.
We need this, because - based on succss of the operation- we will set some visual cues in the form, and also delete a tree node corresonding the object.
If the call returns without an exception then you know it succeeded so you can proceed from there.
Use a Try Catch block and call Delete.If there is no exception, set your visual cues and delete the tree node.
Joe
This is not true in all scenario. If you send a DELETE SQL to any database, and if no record is deleted due to any reason (say, criteria mismatch) - then its not an error. So, just after the delete command inside the database - you have to return ROWCOUNT (in case of Oracle). Then out from the stored procedure - you have to check how many records were affected by the last query.
So, I do have the need to return a record count to front end - somehow. Anyone have any other idea?
Copyright (c) Marimer LLC