ASP is so simple that many developers don't think about error handling. Error handling can make your application more logical. I have seen many commercial websites written in ASP, and most of them ignore error handling. Wrong type.
There are three main types of errors:
1. Compilation error:
This kind of error usually occurs due to syntax problems in the code. ASP stopped running due to a compilation error.
2. Run error:
This error occurs when you are preparing to run ASP. For example: if you try to assign a value to a variable, but it is outside the allowed range of the variable.
3. Logic error:
Logical errors are the most difficult to detect. This error is often a structural error that cannot be found by computers. This requires us to inspect our code from top to bottom.
Because compilation errors generally occur together with logical errors and can usually be displayed, so we only worry about running errors. It all terminates the running of ASP and leaves a bunch of very unfriendly text to the user. So how do we deal with runtime errors?
Error type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is TRUE, or the current record has been deleted and the required operation requires a current record.
Reason: When you used SQL to search for records in the database, the search result was empty, and you did not handle the situation of empty records.
Solution: 1. If you do not believe that the search result is empty, then you should consider whether your SQL statement is correct; 2. If it is indeed empty, then you should add "if rs.eof then" or "do while not rs.eof "Statements like " are used to handle the eof situation.
Error type:
(0×80020009)
An accident occurred.
Reason: When using SQL to search for database records, the search result was empty, and you called records such as rs("aa") in the subsequent code.
Solution: Either the same as above, plus the judgment and processing of rs.eof, or your SQL statement is wrong, resulting in the record not being found, and the record of rs("aa") cannot be used later.
Error type:
Active Server Pages, ASP 0126 (0×80004005)
Included file 'xxx.asp' not found.
Reason: As the error message says, this include file does not exist.
Solution: If you are sure that this file exists, then your path is written wrong. For example, its path relative to the root directory of the website should be inc/xxx.asp, then inc/xxx.asp should be written in include, and Not just xxx.asp. Attachment: The way to write include is:
Error type:
Microsoft OLE DB Provider for ODBC Drivers (0×80004005)
[Microsoft][ODBC Microsoft Access Driver] The operation must use an updateable query.
Reason: This is very common on XP servers and is a server configuration problem, or a user permissions problem.
Solution: If the error is only debugging on this machine, right-click the folder where the website is located, click "Sharing and Security...", click Add... in "Security", write everyone, and then enable this user's The permissions are all, that is, all except the first one are checked. After confirming, refresh and it can be used. (Note: If you cannot find the "Security" option, click "Tools" in any folder, then "Folder Options" - "View", and uncheck the "Use Simple File Sharing" column. Can)
Error type:
Microsoft VBScript compiler error (0x800A0401)
Statement not ended
Reason: Syntax error.
Solution: Check the lines prompted by the system. If the prompt happens to be the last line of this page, it is very likely that the if statement forgot to write "end if", and the select statement forgot to write "end select". In short, there is no end where end is needed, causing the server to not find it. At the end of the statement, the error has to be displayed on the last line.
Error type:
Microsoft JET Database Engine (0x80040E10)
At least one parameter has no value specified.
Reason: When writing SQL statements, we often call some parameters, and it is possible that one of these parameters has not been assigned a value.
Solution: Check whether the value of each parameter is actually passed. It is very likely that some parameters are actually "". Of course, it is not possible to index the database with such parameters.
Error type:
Microsoft JET Database Engine (0x80040E37)
The Microsoft Jet database engine cannot find input table or query 'AA'. Determine whether it exists and whether its name is spelled correctly.
Reason: This table does not exist.
Solution: Maybe you wrote the wrong table name or connected to the wrong database? Check it carefully again!
Error type:
Microsoft VBScript runtime error (0x800A000D)
Type mismatch: /'[string: ""]/"
Reason: It's because the type of your variable is string, but you use it as a number or other type.
Solution: For example, if you need a numeric variable to calculate mathematical operations such as i=i+1, you should use cint (variable name) on the variable to force conversion to numeric type. The comparison between the two variables must also be of the same type. , so it also needs to be converted, the method is the same as above.
Error type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in standard expression.
Reason: Generally, an error occurs when writing SQL statements, that is, numeric and string variables are confused.
Solution: It's easy to do. Try removing the single quotes from the variables in SQL that have "" added, or adding "" to the variables that were originally thought to be numbers, and then check the effect.
Error type:
Microsoft VBScript running error (0x800A01A8)
Missing object:"
Reason: It is very likely that you have not defined the rs object.
Solution: Don't forget to write set rs=server.CreateObject("adodb.recordset"), so that you can define the object; or don't use this method of writing, just use conn.execute("SQL"), which will be much more convenient and no need Consider object issues.
Error type:
Microsoft VBScript runtime error (0x800A005E)
Invalid use Null: 'Replace'
Reason: Invalid use of functions is common, including Split, etc. The reason is relatively simple, because the content of your Replace is empty.
Solution: It is best to add an IF to check whether the content you want to replace is empty.
Microsoft VBScript Compiler Error Error '800a03f6'
The ODBC driver does not support the required property.
Reason: It may be because there is no field name appearing in the sql statement, usually the field name or sql keyword is written incorrectly. It is also possible that the table to be opened by SQL has been opened exclusively.
Solution: Check every field name and every keyword that appears in the sql statement
Microsoft OLE DB Provider for ODBC Drivers error '80004005′
User 'Admin' on machine 'HDZC-3JQSKBWO02' has exclusive lock on data table 'order_detail'.
Reason: The table required by sql is opened in table design form by access
Solution: Turn off table design
Microsoft VBScript Compiler Error Error '800a03f6'
The item was not found in the collection corresponding to the required name or ordinal number.
Reason: There is no field name that appears in the sql statement. It is generally an error in writing the field name or sql keyword.
Solution: Check each field name that appears in the sql statement
ADODB.Recordset error '800a0e78′
No operations are allowed while the object is closed.
Reason: rs.close was used to close the rs object before the rs.open sql,conn,3,3 statement.
Solution: Remove the previous rs.close
Microsoft OLE DB Provider for ODBC Drivers error '80040e14′
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'oid form classtree where oid = 25′.
Reason: There is an illegally written English keyword or subparagraph error in the sql statement.
Solution: Type out the sql statement, and then compare it word by word to find out the writing errors.
The operation requires an updateable query
Answer: Check whether the library file is read-only.
Answer 2: The sorted (order by) record set (rs) does not allow update operations (rs.update)
3219 Operation not allowed on this content
Answer 3: Whether the database field properties are set to allow null value insertion.
adErrInvalidArgument 3001
0x800A0BB9
The application uses a parameter that is of the wrong type, is outside the acceptable range, or conflicts with other parameters.
adErrNoCurrentRecord 3021
0x800A0BCD
BOF or EOF is True, or the current record has been deleted. The operation requested by the application requires the current record.
adErrIllegalOperation 3219
0x800A0C93
The operation requested by the application is not allowed in this context
adErrInTransaction 3246
0x800A0CAE
The application cannot explicitly close the Connection object during a transaction.
adErrFeatureNotAvailable 3251
0x800A0CB3
The provider does not support the operation requested by the application.
adErrItemNotFound 3265
0x800A0CC1
ADO cannot find an object in the collection that corresponds to the name or sequence reference requested by the application.
adErrObjectInCollection 3367
0x800A0D27
Unable to append, object is already in the collection.
adErrObjectNotSet 3420 0x800A0D5C The object referenced by the application no longer points to a valid object.
adErrDataConversion 3421
0x800A0D5D
The application has used a value type that is not suitable for the current operation.
adErrObjectClosed 3704
0x800A0E78
If the object is closed, the operation requested by the application is not allowed.
adErrObjectOpen 3705
0x800A0E79
If the object is open, the operation requested by the application is not allowed.
adErrProviderNotFound 3706
0x800A0E7A
ADO cannot find the specified provider.
adErrBoundToCommand 3707
0x800A0E7B
The application cannot use the Command object to change the ActiveConnection property of the Recordset object to its source data.
adErrInvalidParamInfo 3708
0x800A0E7C
The application defines the Parameter object incorrectly.
adErrInvalidConnection 3709
0x800A0E7D
An application requests an operation on an object by referencing a closed or invalid Connection object.
ADODB.Field Error '80020009' Either BOF or EOF is 'true', or the current record has been deleted and the required operation requires a current record.
The solution is as follows: This error is caused by the fact that the records of SELECT and DELETE do not exist, or there are no records in the library, so check the SQL statement and whether the conditions of SELECT and DELETE are correct. It is also best to SELECT a record or use On before DELETE. Error Resume Next…….On Error Goto 0 to handle. If it is because there is no record in the library, just add a judgment If objRecordSet.Eof And objRecordSet.Bof Then. Because when the RecordSet is opened, the pointer points to the end by default, so you can just use If objRecordSet.Eof Then to judge.
ActiveServerPages,ASP0126(0×80004005)–>include file not found
MicrosoftOLEDBProviderforODBCDrivers(0x80040E21)–>SQL statement error (data type mismatch or table name (field name) error or table is in editing state, or table does not exist in the database opened by conn)
MicrosoftOLEDBProviderforODBCDrivers(0x80040E14)–>SQL statement error (field name error, or data type mismatch)
MicrosoftOLEDBProviderforODBCDrivers(0x80040E07)–>sql statement error (the type of the field to be inserted or updated does not match the variable data type)
MicrosoftOLEDBProviderforODBCDrivers(0x80040E57)–>sql statement error (data to be inserted or updated overflows)
MicrosoftOLEDBProviderforODBCDrivers(0x80040E10)–>SQL statement error (update field name or data type to be updated is wrong)
MicrosoftOLEDBProviderforODBCDrivers(0×80004005)–>sql statement error (the value of the field to be inserted or updated cannot be null)
MicrosoftOLEDBProviderforODBCDrivers(0×80004005) –>Error opening database, no database found in the specified directory
MicrosoftOLEDBProviderforODBCDrivers(0x80040E37)–>Table not found
MicrosoftVBscript runtime error (0x800A000D)–>Error referencing rs variable (rs object is closed or undefined)
MicrosoftVBscript runtime error (0x800A01C2)–>vbscript script error (vbscript statement error)
MicrosoftVBscript runtime error (0x800A0006)–>vbscript script error (overflow error)
MicrosoftVBscript compiler error (0x800A040E)–>missing loop
MicrosoftVBscript compiler error (0x800A03EA)–>missing if or endif
MicrosoftVBscript compiler error (0x800A03EE)–>Statement not ended (missing ")")
MicrosoftVBscript compiler error (0x800A03F6)–>if statement error (missing endif)
MicrosoftVBscript runtime error (0x800A005B)–>set is missing
MicrosoftVBscript runtime error (0x800A0005)–>Variable is not defined
MicrosoftVBscript compiler error (0x800A03F9)–>if statement is missing then
MicrosoftVBscript compiler error (0x800A0411)–>dim statement definition error
ADODB.Recordset(0x800A0BB9)–>SQL statement error (SQL statement or conn statement is not defined or an error occurs when assigning a value to an rs attribute)
ADODB.Recordset(0x800A0CC1)–>rs object error (the rs object itself does not exist or incorrectly references a non-existent field name)
ADODB.Recordset(0x800A0BCD)–>rs object error (there is no record in the record set but the record set is operated)
ADODB.Recordset(0x800A0E78)–>rs object error (record set does not exist, rs.open statement is missing)
ADODB.Recordset(0x800A0CC1) –> rs object error (referencing a non-existent field name)
ADODB.Recordset(0x800A0E7D)–>conn definition error
ADODB.Recordset(0x800A0CB3)–>The database is opened in read-only mode and data cannot be updated.