Platform SDK: CDO for Windows 2000 |
CDO for Windows 2000 and the ActiveX Data Objects (ADO) component provide extensive libraries of constants within their associated type libraries. Using the new Internet Information Services (IIS) Web page keyword METADATA, you can easily import these constants into your Active Server Pages (ASP) applications and make them globally available when scripting.
To import these constants, you place a METADATA directive like the following at the top of your ASP file or within your global.asa file:
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" --> <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" -->
This METADATA directive has the effect of importing the type information into the page at runtime, so you can use module constant names within your scripts without having to define them before hand.
<!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Type Library" --> <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" --> <HTML> <BODY> <H1>Test the METADATA Directive Page</H1> <p>Here are some of the field name string constants within CDOSYS type library :</p> <H4>Some CDO for Windows 2000 String Constants</H4> <TABLE> <TR><TD><b>cdoTo</b> </TD><TD><%=cdoTo%> </TD></TR> <TR><TD><b>cdoFrom</b> </TD><TD><%=cdoFrom%> </TD></TR> <TR><TD><b>cdoUTF_8</b></TD><TD><%=cdoUTF_8%></TD></TR> </TABLE> <H4>Some CDO for Windows 2000 Enumeration Constants</H4> <TABLE> <TR><TD><b>cdoSendUsingPickup</b></TD><TD><%=cdoSendUsingPickup%> </TD></TR> <TR><TD><b>cdoSendUsingPort</b></TD><TD><%=cdoSendUsingPort%></TD></TR> </TABLE> <H4>Some ADO Enumeration Constants</H4> <TABLE> <TR><TD><b>adReadAll</b> </TD><TD><%=adReadAll%> </TD></TR> <TR><TD><b>adReadLine</b> </TD><TD><%=adReadLine%> </TD></TR> <TR><TD><b>adTypeBinary</b> </TD><TD><%=adTypeBinary%> </TD></TR> <TR><TD><b>adTypeText</b> </TD><TD><%=adTypeText%> </TD></TR> </TABLE> </BODY> </HTML>
To add type information from other type libraries, simply add another METADATA directive to your ASP file.
Putting these directives in your global.asa
file makes all of these constants available across the current ASP application.