Sadly, VBScript does not understand ADO constants, such as AdLockReadOnly, the way VB does. Luckily (or unluckily) for the developer, the immense number of constants for use with ADO is compiled in a file called ADOVBS.inc. When starting out with database development, everyone is told to use the constant names (as opposed to their integer counterparts), and to include ADOVBS.inc. This recommendation is given by many people, even if you are only using 2 or 3 of the 393 constants that are listed in ADOVBS.inc.
These 393 constants result in an overall raw read size of 14,639 bytes. Never mind the amount of memory allocated to holding all of those variables, most of which you have no intention of using. On a small, single-user app, you won't see a difference. However, when you have 300 people on your site at once, every single user has to load that 15kb file, and every user has 393 extra page-level variables in memory... this can really add up.
This is why my suggestion will always be to either:
- Write your own adovbs.inc file, with only the handful of constants you need;
- Only define constants as you need them;
- Place the relevant constant/value pairs in a comment, and use the integer equivalent in the actual code; or
- Use <!--METADATA...--> references in global.asa.
If you have Yukon / MDAC 9.0 installed:
<!--METADATA TYPE="typelib" NAME="Microsoft ActiveX Data Objects 9.0 Library" UUID="{FD6974FD-21FB-409C-9656-A568FEC0AC01}" VERSION="9.0"--> |
If you have MDAC 2.8:
<!--METADATA TYPE="typelib" NAME="Microsoft ActiveX Data Objects 2.8 Library" UUID="{2A75196C-D9EB-4129-B803-931327F72D5C}" VERSION="2.8"--> |
If you have MDAC 2.7:
<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.7 Library" UUID="{EF53050B-882E-4776-B643-EDA472E8E3F2}" VERSION="2.7"--> |
If you have MDAC 2.6:
<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.6 Library" UUID="{00000206-0000-0010-8000-00AA006D2EA4}" VERSION="2.6"--> |
And if you're stuck with MDAC 2.5, use the following:
<!--METADATA TYPE="TypeLib" NAME="Microsoft ActiveX Data Objects 2.5 Library" UUID="{00000205-0000-0010-8000-00AA006D2EA4}" VERSION="2.5"--> |
If you're using a version of MDAC prior to 2.5, it's time to upgrade to the most recent version (see MDAC Download Page).
If you attempt to use a METADATA tag for a version you don't have, you'll get the following error:
Active Server Pages error 'ASP 0223' TypeLib Not Found /<file>, line <line> METADATA tag contains a Type Library specification that does not match any Registry entry. or Active Server Pages error 'ASP 0224' Cannot load TypeLib /<file>, line <line> Cannot load Type Library specified in the METADATA tag. |
Note that this same argument holds true if you are using JScript and its equivalent include file, ADOJAVAS.INC.