Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
05.02.2002, 10:38
|
|||
---|---|---|---|
|
|||
вывод списка SQL - серверов |
|||
#18+
Может кто в курсе как помочь? ... |
|||
:
Нравится:
Не нравится:
|
|||
|
05.02.2002, 10:57
|
|||
---|---|---|---|
вывод списка SQL - серверов |
|||
#18+
Вотт так: Option Explicit Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long 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 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Private Const SV_TYPE_SERVER As Long = &H2 Private Const SV_TYPE_SQLSERVER As Long = &H4 Private Type SV_100 platform As Long name As Long End Type Public Sub GetSQLServers() ' ' You could change this to be a function returning ' a list of the SQL servers in a ADOR Recordset or an array etc. ' ' At present, it just does a debug.print of all the ' SQL servers on the network. ' ' Dim l As Long Dim entriesread As Long Dim totalentries As Long Dim hREsume As Long Dim bufptr As Long Dim level As Long Dim prefmaxlen As Long Dim lType As Long Dim domain() As Byte Dim i As Long Dim sv100 As SV_100 level = 100 prefmaxlen = -1 lType = SV_TYPE_SQLSERVER domain = "placeYourDomainNameHere" & vbNullChar l = NetServerEnum(ByVal 0&, _ level, _ bufptr, _ prefmaxlen, _ entriesread, _ totalentries, _ lType, _ domain(0), _ hREsume) If l = 0 Or l = 234& Then For i = 0 To entriesread - 1 CopyMemory sv100, ByVal bufptr, Len(sv100) Debug.Print Pointer2stringw(sv100.name) bufptr = bufptr + Len(sv100) Next i End If NetApiBufferFree bufptr ' End Sub Private Function Pointer2stringw(ByVal l As Long) As String Dim buffer() As Byte Dim nLen As Long ' nLen = lstrlenW(l) * 2 If nLen Then ReDim buffer(0 To (nLen - 1)) As Byte CopyMemory buffer(0), ByVal l, nLen Pointer2stringw = buffer End If End Function ... |
|||
:
Нравится:
Не нравится:
|
|||
|
|
start [/forum/topic.php?fid=60&tablet=1&tid=2171666]: |
0ms |
get settings: |
10ms |
get forum list: |
14ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
30ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
41ms |
get tp. blocked users: |
1ms |
others: | 303ms |
total: | 420ms |
0 / 0 |