Setting Libraries

To use ADO and ADO extensions, the corresponding libraries must first be referenced. Here are the latest versions as of 2002 Jan:

EG VB and VBA

Dim cmdObject1 as New ADODB.Command
Dim cmdObject2 as ADODB.Command

EG VBS and JS

Set cmdObject = Server.CreateObject("ADODB.Command") 'VBS
var cmdObject = Server.CreateObject("ADODB.Command"); //JS

EG Visual C++

_CommandPtr  rs("ADODB.Command");

ADO Named Constants

ADO Named Constants hold values that are frequently used by the methods of ADO objects. This makes the code easier for developers to write and read.

EG: The first line of code has the actual parameter values but the second uses the ADO named constants:

rsMy.Open sql, cnn1, 0, 1, 1
rsMy.Open sql, cnn1, adOpenForwardOnly, adLockReadOnly, adCmdText

In VB and VBA, ADO named constants are available by the mere fact that a VB project is referencing the ADO type library.

VBScript and JavaScript do not support type libraries but they can include files which declare and initialize the constants. The files are usually located and named as follows:

'Server-side constants
C:\Program Files\Common Files\System\ado\adovbs.inc
'Client-side constants
C:\Program Files\Common Files\System\msdac\adcvbs.inc

Here is an example of how SSI directive code might include the adovbs.inc file:

<!-- #include file="..\includes\adovbs.inc" -->

Miscellany

Page Modified: (Hand noted: 2007-10-10 19:02:09Z) (Auto noted: 2010-12-24 22:47:28Z)