Includes a reference to an external type library.
<reference [object="progID" |guid="typelibGUID"] [version="version"]>
If the object attribute is specified, you cannot also specify a guid attribute.
Referencing a type library in your script component allows you to use constants defined in the type library in scripts. The <reference> element looks up and makes available the type library associated with a specific program ID or type library name. Type library information can be available in .tlb, .olb, or .dll files.
The <reference> element should appear inside the <component> element. If there is more than one script component in the package, the type library applies to only the script component in whose <component> element it is declared.
In the following script component fragment, referencing the type library for ADO (contained in the file MSAD015.DLL) allows you to use ADO constants such as adStateOpen in your scripts.
Note A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.
<reference object="ADODB.Connection.2.0"/>
<registration progid="ADOScriptlet"/>
<public>
<property name="cnnstate"/>
<method name="openConnection"/>
<method name="closeConnection"/>
</public>
<script language="VBScript">
<![CDATA[
Dim cnn
Dim cnnState
Function openConnection()
Set cnn = CreateObject("ADODB.Connection")
cnn.ConnectionString =
"driver={SQL Server};server=myserver;uid=sa;database=pubs"
cnn.Open
If cnn.State = adStateOpen Then
cnnState = "open"
Else
cnnState = "closed"
End If
End Function
Function closeConnection()
cnn.Close
cnnState = "closed"
End Function
]]>
</script>