I have an ActiveX DLL to read database connection settings from the Windows registry. It works great in VB 6, but am trying to use it in VBScript. Whenever I call a method of the DLL class, I get a Type Mismatch error.
My code looks like this:
Dim sServer, sDB, sLogin, sPW
Dim oConn
Dim oReg 'registry object
Dim cRegistryKey
Dim cEncryptKey
Dim vDBSettings()
Dim iCounter
Dim lRC
cRegistryKey="Software\CompName\DBConnections"
Set oReg = CreateObject("WinRegistry.clsRegistry"
Set oConn = CreateObject("ADODB.Connection"
lRC = oReg.CheckKey(cRegistryKey)
If lRC = 0 Then 'key exists
'get the registry settings and put into an array variable
vDBSettings = oReg.GetRegistrySettings(cRegistryKey)
'if settings found
If IsArray(vDBSettings) Then
'check to see that all values other than password not blank
etc ...
The first call returns a long, second returns an array. I get the type mismatch error on both.