What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error()
method with a particular state int value, I have used a stored procedure returning int values, and I have also selected a msg column with a particular structure. Are there any best practices for this?
i always do two things:
this lets me catch errors both in C# code and also when one stored procedure calls another
[sql server now supports a try-catch block, but i haven't used it yet]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.