Question

I am supporting a legacy ASP page which creates an ADODB stream object like this, then attempts to set it's type with an ADODB enumerator.

Set BinaryStream = Server.CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary

Whenever I run this I get the following error:

Variable is undefined: 'adTypeBinary'

However, if I explicitly name my enumerator, like this, it works

 BinaryStream.Type = ADODB.StreamTypeEnum.adTypeBinary

This is running on several instances of servers, which are theoretically all in sync in terms of configuration and files and such. This works on all the servers except one, and I'm not sure what we did to have this start happening. I can confirm this is happening to at least one other library we use. What is going on here? Thanks!

Was it helpful?

Solution

AFAIK outside of an external include that defines those values, the only way that you can use unqualified members like that is to define a typelib reference in your global.asa:

<!--METADATA TYPE="typelib" 
NAME="Microsoft ActiveX Data Objects 2.8 Library" 
UUID="{2A75196C-D9EB-4129-B803-931327F72D5C}" 
VERSION="2.8"-->
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top