Accessing ADO Constants from ASP pages
Here's a tip for old ASP coders. (this is not for the new ASP.NET)
When using ADO in ASP pages, it is convenient to use the various ADO enumerated constants (eg. adOpenKeyset, adLockReadOnly, etc.) instead of the obscure numeric values that can be used as an alternative. But the only problem with this on ASP pages is that the adovbs.inc file, which declares these constants, must be included with the each ASP page that uses the constants.
While this gives more readable code, it increases the size of the ASP pages and adds overhead when the ASP page is compiled and run when it is called.
If you don't like the idea of including the adovbs.inc file in your ASP pages because of the related overhead that is incurred, but you would like the convenience of not having to use meaningless constants in your code, the option is to load the adovbs.inc file using a <METADATA> tag instead of adding it as an include, using this format:
To make life even easier, you can have this line in the global.asa file instead of adding it on all the ASP pages. More information on MSDN.
When using ADO in ASP pages, it is convenient to use the various ADO enumerated constants (eg. adOpenKeyset, adLockReadOnly, etc.) instead of the obscure numeric values that can be used as an alternative. But the only problem with this on ASP pages is that the adovbs.inc file, which declares these constants, must be included with the each ASP page that uses the constants.
<!-- #INCLUDE FILE="C:\Program Files\Common Files\System\ado\adovbs.inc" -->While this gives more readable code, it increases the size of the ASP pages and adds overhead when the ASP page is compiled and run when it is called.
If you don't like the idea of including the adovbs.inc file in your ASP pages because of the related overhead that is incurred, but you would like the convenience of not having to use meaningless constants in your code, the option is to load the adovbs.inc file using a <METADATA> tag instead of adding it as an include, using this format:
<!-- METADATA TYPE="typelib" FILE="c:\program files\common
files\system\ado\msado15.dll" -->To make life even easier, you can have this line in the global.asa file instead of adding it on all the ASP pages. More information on MSDN.


1 Comments:
At Oct 18, 2005 2:32:00 PM, Anonymous said…
definitely the global.asa... why would you want all this stuff crowding your asp files? yuck.
Post a Comment
<< Home