views:

96

answers:

2

How to list all the instances of SQL Server 2005 Express Edition using vb6 application?

+1  A: 

This will list all SQL Server instances using SQL-DMO. You will need to filter for Express instances.

Function listServers(vControl As Object)
    Dim oApp As SQLDMO.Application 
    Dim oNames  As SQLDMO.NameList 

    Set oApp = New SQLDMO.Application 
    Set oNames = oApp.ListAvailableSQLServers() 

    For Each oName In oNames 
        vControl.AddItem oName 
    Next 
End Function 

From here.

This SO question says that it won't find Express instances; need to use SQLBrowseConnect.

Mitch Wheat
+1  A: 

This sample is using SQLBrowseConnect API.

wqw