Share via


Using Type Libraries in ASP Pages

Type libraries are files that provide information about your component. Development tools use the information contained in type libraries to make it easier for you to determine the methods and properties supported by your component. You should create a type library for use with your component. If you develop with Visual Basic or Visual J++?, a type library is automatically generated when you make the DLL.

If you have defined constants in your COM component, they will be included in the type library. Scripts can then access these constants if a reference to the type library has been included in the Global.asa file for the application. For example, the ActiveX Data Objects (ADO) define constants for connection settings. If you want to use these constants in .asp files, you can add the following line to your global.asa file.

<!--METADATA TYPE="TypeLib" 
uuid={00000200-0000-0010-8000-00AA006D2EA4} 
--> 

By adding this reference to the global.asa file for an application, .asp files will be able to use the constants defined in msado20.dll. For example, the following script snippet uses the adLockOptimistic constant.

<% 
  Dim objRecordset 
  Dim objConnection 
  Set objConnection = Server.CreateObject ("ADODB.Connection") 
  Set objRecordset = Server.CreateObject ("ADODB.Recordset") 
  Set ObjRecordset.ActiveConnection = objConnection 
  ObjRecordset.LockType = adLockOptimistic 
%>