ASP in Nutshell by O'Reilly
Author:O'Reilly [O'Reilly]
Language: fra
Format: epub
Tags: Informatique
Publisher: O'Reilly
Published: 1999-11-12T11:56:50+00:00
Description (Error Object)
Notes
The CursorType property of the Recordset object is read-only if the recordset is
already open but read/write otherwise.
If you attempt to set the CursorType property to a value not supported by your
underlying data provider, the data provider may return a cursor of a different type
than you set. However, if this happens, the CursorType property value reflects this
change. Then, once the recordset is closed, the CursorType property value reverts
to the value you set. You can use the Supports method of the Recordset object to
determine which cursors are supported by a given data provider, according to
Table 11-19.
Table 11-19: Determining if a Data Provider Supports a Cursor Type
If Supported, Method Returns True
with These Parameters
Cursor Type Supported
None
adOpenForwardOnly
adBookmark, adHoldRecords, adMovePrevious,
adOpenKeyset
adResync
adMovePrevious
adOpenDynamic
adBookmark, adHoldRecords, adMovePrevious,
adOpenStatic
adResync
What happens if one of the tests on the right fail for your selected cursor type?
Suppose you attempt to set the CursorType to one of the cursor type constants in
the right column, but one or more of the Supports method calls in the left column
returns False. The result is unpredictable, but most often the underlying data
provider will simply change the cursor type when you attempt to open the
recordset.
Description (Error Object)
objError.Description
A read-only string that provides textual information describing the error that the
underlying data provider raised in response to incorrect syntax or lack of support.
Description is a property of each Error object in the Connection object’s Errors
collection. It is not the same as the Description property of the ASP Err object.
Parameters
None
Example
The following example demonstrates the use of the Description property of the
Error object. Notice that for this example to work properly, the Response object’s
Buffer property must be set to True because we use the Response’s object’s Clear
and End methods.
<%@ LANGUAGE="VBSCRIPT" %>
190 Chapter 11 – ActiveX Data Objects 1.5
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
Description (Error Object)
<%Response.Buffer = True%>
<HTML>
<HEAD>
<TITLE>ADO Examples</TITLE>
</HEAD>
<BODY>
<%
ActiveX Data
Objects 1.5
' 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 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 user of the error.
Response.Clear
Response.Write _
"One or more errors have occurred.<BR>"
For intCounter = 0 to objDBConn.Errors.Count
Response.Write "The " & intCounter & " error's "
Response.Write "error number is " & _
objDBConn.Errors(intCounter).Number & ".<BR>"
Response.Write "The description for this "
Response.Write "error is <BR>" & _
objDBConn.Errors(intCounter).Description & ".<BR>"
Next
Response.End
End If
...[additional code]
Notes
Each time an error occurs in the data provider, ADO adds an Error object to the
Errors collection of the Connection object corresponding to that data provider. The
provider is responsible for generating and sending the actual error text to ADO,
but ADO can modify it before setting the description that it adds to the Connec-
tion object’s Errors collection.
Description (Error Object) 191
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Fusion 360 for Makers by Lydia Sloan Cline(1812)
Networking A Beginner's Guide by Bruce Hallberg(1771)
But How Do It Know? by J. Clark Scott(1678)
Arduino Project Handbook, Volume 2: 25 Simple Electronics Projects for Beginners by Geddes Mark(1654)
Computers For Seniors For Dummies by Nancy C. Muir(1654)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1570)
Hack and HHVM by Owen Yamauchi(1553)
PrestaShop Recipes by Arnaldo Pérez Castaño(1367)
Raspberry Pi Electronics Projects for the Evil Genius (Tab) by Norris Donald & Norris Donald(1294)
Getting Started with Soldering: A Hands-On Guide to Making Electrical and Mechanical Connections by Vinck Marc de(1279)
Healthcare Information Security and Privacy (All-In-One) by Sean Murphy(1251)
The Internet of Things (The MIT Press Essential Knowledge series) by Greengard Samuel(1244)
Shaping the Fourth Industrial Revolution by Klaus Schwab & Nicholas Davis & Satya Nadella(1229)
Raspberry Pi Beginners Guide: Ultimate Guide For Rasberry Pi, User guide To Get The Most Out Of Your Investment, Hacking, Programming, Python, Best Hardware, Beginners Guide To Rasberry Pi by Steven Giles(1216)
Home Robotics by Daniel Knox(1195)
Getting Started with the micro:bit by Wolfram Donat(1192)
Mastering Docker - Second Edition by McKendrick Russ & Gallagher Scott(1185)
Mobile Computing Deployment and Management by Robert J. Bartz(1182)
Building Evolutionary Architectures by Neal Ford(1151)
