freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

網(wǎng)絡(luò)bbs的設(shè)計與實現(xiàn)過程畢業(yè)論文-資料下載頁

2025-06-23 02:05本頁面
  

【正文】 doesn’t exist, the database connection times out, or the code has insufficient security credentials).One infamous type of error is the null reference exception, which usually occurs when a program attempts to use an uninitialized object. As a .NET programmer, you’ll quickly learn to recognize and resolve this mon but annoying mistake. The following code example shows the problem in action, with two SqlConnection objects that represent database connections:// Define a variable named conOne and create the object.private SqlConnection conOne = new SqlConnection()。// Define a variable named conTwo, but don39。t create the object.private SqlConnection conTwo。public void cmdDoSomething_Click(object sender, EventArgs e){// This works, because the object has been created// with the new keyword. = ...。...// The following statement will fail and generate a// null reference exception.// You cannot modify a property (or use a method) of an// object that doesn39。t exist! = ...。...}When an error occurs in your code, .NET checks to see whether any error handlers appear in the current scope. If the error occurs inside a method, .NET searches for local error handlers and then checks for any active error handlers in the calling code. If no error handlers are found, the page processing is aborted and an error page is displayed in the browser. Dependingon whether the request is from the local puter or a remote client, the error page may show a detailed description (as shown in Figure 81) or a generic message. You’ll explore thistopic a little later in the “Error Pages” section of this chapter.Even if an error is the result of invalid input or the failure of a thirdparty ponent, an error page can shatter the professional appearance of any application. The application users end up with a feeling that the application is unstable, insecure, or of poor quality—and they’re at least partially correct.If an application is carefully designed and constructed, an error page will almost never appear. Errors may still occur because of unforeseen circumstances, but they will be caught in the code and identified. If the error is a critical one that the application cannot solve on its own, it will report a more useful (and userfriendly) page of information that might include a link to a support or a phone number where the customer can receive additional assistance. You’ll look at those techniques in this chapter.Exception HandlingMost .NET languages support structured exception handling. Essentially, when an error occurs in your application, the .NET Framework creates an exception object that represents the problem. You can catch this object using an exception handler. If you fail to use an exception handler, your code will be aborted, and the user will see an error page.Structured exception handling provides several key features:Exceptions are objectbased: Each exception provides a significant amount of diagnostic information wrapped into a neat object, instead of a simple message and an error code.These exception objects also support an InnerException property that allows you to wrap a generic error over the more specific error that caused it. You can even create and throw your own exception objects.Exceptions are caught based on their type: This allows you to streamlineerrorhandling code without needing to sift through obscure error codes.Exception handlers use a modern block structure: This makes it easy to activate and deactivate different error handlers for different sections of code and handle their errors individually.Exception handlers are multilayered: You can easily layer exception handlers on top of other exception handlers, some of which may check only for a specialized set of errors.Exceptions are a generic part of the .NET Framework: This means they’repletely crosslanguage patible. Thus, a .NET ponent written in C can throw an exception that you can catch in a web page written in VB.Note Exception handlers are a key programming technique. They allow you to react to problems that occur at runtime due to factors outside your control. However, you obviously shouldn’t use exception handlers to hide the bugs that might crop up in your code! Instead, you need to track down these programmer mistakes at development time and correct them. Visual Studio’s debugging features (which were described in Chapter 4) can help you in this task.The Exception ClassEvery exception class derives from the base class . The .NETFramework is full of predefined exception classes, such as NullReferenceException,IOException, SqlException, and so on. The Exception class includes the essential functionality for identifying any type of error.MemberDescriptionHelpLink A link to a help document, which can be a relative or fully qualified URL (uniform resource locator) or URN (uniform resource name), such as file:///C:/ACME/MyApp/Err42. The .NET Framework doesn’t use this property, but you can set it in your custom exceptions if you want to use it in your web page code.InnerExceptionA nested exception. For example, a method might catch a simple file IO (input/output) error and create a higherlevel “operation failed” error. The details about the original error could be retained in the InnerException property of the higherlevel error.MessageA text description with a significant amount of information describing the problem.Source The name of the application or object where the exception was raised.StackTraceA string that contains a list of all the current method calls on the stack, in order of most to least recent. This is useful for determining where the problem occurred.TargetSiteA reflection object (an instance of the class) that provides some information about the method where the error occurred. This information includes generic method details such as the method name and the data types for its parame
點擊復(fù)制文檔內(nèi)容
電大資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1