TAILIEUCHUNG - Take Care of Error Handling with Bound Controls

Hãy chăm sóc Lỗi Xử lý với Bound Controls Khi giao dịch với nhiệm vụ cơ sở dữ liệu, bạn sẽ nhận được lỗi runtime. Trong. NET, chúng ta gọi các loại lỗi bạn có thể có được ngoại lệ | Take Care of Error Handling with Bound Controls When dealing with database tasks you are going to get runtime errors. In .NET we call the various types of errors you can get exceptions. This How-To shows examples of what exceptions could occur and how to handle them using the Try Catch and Finally statements. Adding and deleting records is fine but what happens if an error occurs You tried to delete an existing company and got the screen that appears in Figure . Figure . This is an unhandled error called an exception in .NET. How do you make it so errors are handled gracefully within the application using bound controls Technique Error handling is one of the most important aspects of working with data between when a user is entering data and updating the server. If you don t have proper error handling your system will in the best situation give an ugly error message and in the worst blow up and put bad data in your system. In Visual Studio .NET errors are classes called exceptions. Many different inherited types of exceptions exist. Run-time exceptions can occur in just about any part of your application. They can be handled by using or they can be unhandled where you will see the error in Figure . Figure . This error was thrown up from one subroutine to the one that called it. Take a look at a common way to trap exceptions shown in Listing . Listing Standard Code for Handling Exceptions Private Sub MySub Try -Code to be handled here Catch dataException as Exception Finally -Code that will occur regardless of if an error occurs. End Try End Sub Following are some basic points to help you when working with exceptions and blocks The name of the exception object can be whatever you want it to be. dataException was just used as an example. Specific types of exceptions inherit from the base class of . OleDbException is one of those classes and you will

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.