
Finds SQL Servers on your LAN
Inputs
Needs you to enter your LAN's Domain name
Assumes
Modified from code originally uploaded by Mike G ([email protected]), which I found had a couple of problems. This version seems to fix them.
Returns
Returns a list of all SQL Servers found, in this example it places them into a combobox control
Side Effects
?
API Declarations' kernel32 declaration
Private Declare Sub CopyMemory Lib "kernel32" Alias _
"RtlMoveMemory" (Destination As Any, _
Source As Any, _
ByVal Length As Long)
' netapi declarations
Private Declare Function NetServerEnum Lib "netapi32" ( _
strServername As Any, _
ByVal Level As Long, _
bufPtr As Long, _
ByVal PrefMaxLen As Long, _
EntriesRead As Long, _
TotalEntries As Long, _
ByVal ServerType As Long, _
strDomain As Any, _
ResumeHandle As Long) As Long
Private Declare Function NetApiBufferFree Lib "Netapi32.dll" _
(ByVal lpBuffer As Long) As Long