Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQLDMO not working when not on network (VB6 (SR6))

    Public Function GetServerList() As String
    On Error GoTo err
    Dim SQL7 As New SQLDMO.Application
    Dim NameList As SQLDMO.NameList
    Dim x As Integer
    Set NameList = SQL7.ListAvailableSQLServers
    For x = 0 To NameList.Count
    debug.print NameList(x)
    Next
    GetServerList = "success"
    Exit Function
    err:
    MsgBox err.Number & err.Description
    End Function


    I'm using the Microsoft SQLDMO object library with the above function to return a list of SQL servers. This works fine while connected to a network (including finding the local SQL server), but fails to return any servers if not connected to a network. I'd have thought it would still have picked up the local server. Would anyone know why it doesn't?

  2. #2
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQLDMO not working when not on network (VB6 (SR6))

    After some successful research, it seems the SQLDMO object is a bit buggy to say the least and this is one of the things that doesn't work.

    The solution lies with the NetServerEnum API, but it looks quite complex. Luckily i've found a dll that does the job, but I'll try and find time to work out the API for myself if I can. If (when... I hope) that happens, Ill post my results here.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQLDMO not working when not on network (VB6 (SR6))

    So close.........

    It seems the NetServerEnum API doesn't work under windows 9x/Me

    Back to the drawing board!

    If anyone has a solution to getting a list of SQL Servers which works on any Windows OS networked or otherwise, any help would be much appreciated.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: SQLDMO not working when not on network (VB6 (SR6))

    I don't have the solution, but there were pre-NT/2000 APIs for a lot of this stuff. Perhaps digging in Google Groups for posts on MS news forums related to SQL Server will help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •