Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: IIS5,ASP
Expertise: Intermediate
Apr 26, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Use Global.asa Metadata directive to access type libraries

Most ADO statements require special constants to be passed as arguments to method calls, as in:

    rs.Open "Authors", cn, adOpenForwardOnly, adLockReadOnly, adCmdTable
The above line is surely more readable than:

    rs.Open "Authors", cn, 0, 1, 1
but for the first line to work correctly you must, of course, define all the ADO constants you need. When working with ASP under IIS4 you have no choice, but defining all these values with a series of Const statements. Preparing all these Const statements is a tedious work, so must ASP developers prefer to include the ADOVBS.TXT file in all the ASP pages that work with ADO. This is quite a large file, so you might end up adding a lot of statements that you don't actually need in the page at hand. This causes an overhead that should be avoided.

IIS5 introduced a better way to deal with such pre-defined constants. You can make all the constants defined in a type library available to all the ASP pages in an application by adding a special METADATA tag in Global.asa. There are two forms of the METADATA tag, one that refers to the type library by pointing to its file:

<!-- METADATA TYPE="TypeLib" 
     FILE="C:\Program Files\Common Files\system\ado\msado15.dll" -->
and the other that refers to a type library by its GUID:
<!-- METADATA NAME="Microsoft ActiveX Data Objects 2.6 Library" 
     TYPE="TypeLib" UUID="{00000206-0000-0010-8000-00AA006D2EA4} -->
Francesco Balena
Thanks for your registration, follow us on our social networks to keep up-to-date