Name
Number (Error Object) —
objError
.Number
Synopsis
A read-only string that provides the error code number that the underlying data provider raised in response to incorrect syntax or lack of support. This Number property is a property of each Error object in the Connection object's Errors collection. It is not the same as the Number property of the ASPError or the VBA Error objects.
Parameters
None
Example
The following example demonstrates the use of the Number property of
the Error object. Notice that for this example to work properly, the
Buffer property of the Response object must be set to
True because we use the Response object's
Clear and End methods.
<%@ LANGUAGE="VBSCRIPT" %> <%Response.Buffer = True%> <HTML> <HEAD> <TITLE>ADO Examples</TITLE> </HEAD> <BODY> <% ' Include ADOVBS.INC so we can use the ADO constants. %> <!-- #include virtual = "/MySSIncludes/adovbs.inc" --> <% ' Instantiate an ADO Connection object. Set objDBConn = Server.CreateObject("ADODB.Connection") ' Construct the connection string for the Connection object. strConn = _ "driver={MyDBType};;uid=sa;pwd=;database=SalesDB" ' Using the connection string, open the connection. objDBConn.Open strConn ' Check to see if attempting to open a connection to ' the provider resulted in ADO adding Error objects to ' the Connection's Errors collection. If objDBConn.Errors.Count > 0 Then ' An error occurred and ADO added an Error object to ' the Connection's Errors collection. Clear the ' Response buffer and alert the ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access