views:

49

answers:

2

The following code behaves differently depending on if I use the 32 or 64 bit version of wscript:

Set oSQLServer = CreateObject("SQLDMO.SQLServer")

For Each o in oSQLServer.ListInstalledInstances
    MsgBox o
Next

In 32 bit, it will list the instances of my 32bit server (SQL Server 2000), in 64 bit I get the contents of my 64bit server (SQL Server 2008). I need to convert this code to C++ (a 32 bit application). But I need to show the 64bit servers. How do I force the created object to use the 64bit dll and 64bit key in the registry?

+3  A: 

A 32-bit app cannot load a 64-bit DLL, and a 64-bit app cannot load a 32-bit DLL.

Remy Lebeau - TeamB
A: 

I've decided to use ODBC's SQLBrowseConnect with the connection string

"DRIVER={SQL Server Native Client 10.0};".  

SQLDMO is well and truely dead, and SQLSMO is rather short-sightedly for managed applications only.

DanDan