Developers are trying to properly handle accidents, so that users do not have to worry about system error messages like tianshu. For this reason, exception handling is a standard part of every. NET application. The Try/catch Block allows you to capture exceptions and control application execution from this point. Many errors may occur when interacting with databases,
Developers are trying to properly handle accidents, so that users do not have to worry about system error messages like tianshu. For this reason, exception handling is a standard part of every. NET application. The Try/catch Block allows you to capture exceptions and control application execution from this point. Many errors may occur when interacting with the database,
Developers are striving to properlyProcessingBy default, users do not have to worry about the tianshu system.ErrorInformation. For this reason, an exception occurs.ProcessingIs a standard part of every. NET application. The Try/catch Block allows you to capture exceptions and control application execution from this point. AndDataThe library performs many interactive operations.ErrorBut many developers do not know howProcessingDataLibrary LayerError. This article will explore how to use SQLServer and T-SQLProcessingYouDataLibrary codeError.
ProcessingIn T-SQLError
SQL conversation of SQLServer allows you to easilyProcessingNon-fatal events that may occur in stored processes and functionsErrorBut not allErrorEasy to useProcessing. In fact, both fatal and non-fatalErrorThere are many. What is fatal, what is non-fatal, there is no complete documentation on this, but your application code can always use try/catch BlockProcessingFatalDataLibraryError. For all otherErrorYou can use the following technologies.
Transactions
You shouldDataUse transactions in the library code to ensure that all changes are completed when everything is okay. SQL Server online help describes a transaction as a logical unit of a task. It consists of a series of statements (select, insert, update, or delete. If noError, All changes to the transaction will becomeDataThe permanent part of the database. IfError, NoDataLibrary.
A transaction is included between the begin transaction and end transaction statements. The rollback transaction statement can cancel all changes without any changes. You can use the commit transaction statement to make permanent changes. Now let's focus on howProcessingIn T-SQLError.
@ Error
@ Error function enables you to implement T-SQLErrorProcessing. It returnsErrorCode. If noErrorIf this happens, "0" is returned ". @ Error the function must be called immediately after a statement because it is cleared after each T-SQL statement.
12 3 4 next page