Hi,
I would like to handle a sql error in t-sql and return a certain value in case error occurs. For example if I would like to add a record I want to return a certain identity value or maybe a status of transaction (0 for incomplete, 1 for succesfull trans).
If error occurs in sql I cannot return any values back to asp.net because of What I am doing at the moment is catching an error in asp.net and then displaying an error message. Is there a way to return only a return value to asp.net and somehow handle the error in t-sql?
Thanks
Yes, I believe that feature was added in SQL Express/2005, but I'm not familiar enough with it to give examples. Normally, I would not create a SQL query that would ERROR, but it might return an empty resultset, or other indicator that it failed. If I need to catch a true error, then catch it in a try/catch block in your code.
No comments:
Post a Comment