Search code examples
asp.netvb.netasp-classicvb6

How to include adovbs.inc file in an aspx page?


I'm converting ASP classic page to ASP.NET. What's the proper way of including files with .inc extension to aspx pages?

<!--#include virtual = "adovbs.inc" -->

I've notice that each time that I change one of those pages containing the include directive pointing to .inc files to aspx, I'm getting all sort of errors from those .inc files.

I feel like just rewriting the logic inside those .inc files into vb classes.


Solution

  • The purpose of adovbs.inc or adovbs.asp was to provide a list of named constant values from the ADODB DLL (due to Classic ASP relying on late binding in VBScript for most of it's functionality).

    Example snippet of adovbs.asp

    '--------------------------------------------------------------------
    ' Microsoft ADO
    '
    ' (c) 1996-1998 Microsoft Corporation.  All Rights Reserved.
    '
    '
    '
    ' ADO constants include file for VBScript
    '
    '--------------------------------------------------------------------
    
    '---- CursorTypeEnum Values ----
    Const adOpenForwardOnly = 0
    Const adOpenKeyset = 1
    Const adOpenDynamic = 2
    Const adOpenStatic = 3
    
    '---- CursorOptionEnum Values ----
    Const adHoldRecords = &H00000100
    Const adMovePrevious = &H00000200
    Const adAddNew = &H01000400
    Const adDelete = &H01000800
    

    This was until people realised you could use the METADATA data tag to import DLL constants direct from the Type Library instead of needing the adovbs include file.

    <!-- METADATA 
            TYPE="typelib" 
            UUID="00000200-0000-0010-8000-00AA006D2EA4"
    -->
    

    In ASP.Net everything is compiled so there is no need for these constant files as they will already exist in some form in ADO.Net.