I need to modify some legacy code that was written in classic ASP (VBscript).
I have a line that sets a database connection like this:
set m_conn=OpenConn()
I believe that the OpenConn()
function is in a DLL somewhere. This is bad news because we can't locate the source for that dll. So, I've been working on a replacement for that function. This is what i have so far:
function OpenConn()
dim conn
set conn = server.CreateObject("adodb.connection")
conn.open "XXXXconnection-stringXXXXX"
OpenConn = conn
end function
When I try to run the original line set m_conn=OpenConn()
(line 50) I get an ASP error:
Microsoft VBScript runtime error '800a01a8'
Object required: '[string: "Provider=SQLOLEDB.1;"]'
/path/to/include.asp, line 50
I'm not too clear on how this syntax is supposed to work. Usually, I work in C#, but when I need to do things like this in ASP I'd use syntax like this:
set conn = server.createobject("adodb.conection")
conn.activeconnection = "connectionstring"
conn.execute "sql"
set conn = nothing
Anyway, I'm looking for the correct syntax for OpenConn()
so that set m_conn=OpenConn()
will work correctly.
Thanks for any help.