How to list SQL-Server servers in your network

xiaoxiao2021-03-06  19

I have created a window like an ODBC login (as shown below), which contains the server name, database name, user name, password, connection waiting time. . . . Here you explain the "Server" item, use the composite box drop-down list to enumerate the implementation of the SQL-Server server name in the network. (As for how to list the database name in the server, there are many posts in the forum to search, the methods and this difference) first needs to reference SQLDMO. Method: The Microsoft SqldMo Object Library is referenced in "Tools" - "Reference". Code: Private Sub Combo1_DropDown () Dim svr As New SQLDMO.SQLServer Dim i As Integer If Combo1.ListCount> 0 Then Dim Dn As String Dn = Trim (Combo2.Text) 'combo1 is the column name of the database combo control Combo1.Clear Combo1 .Text = DN sendKeys "{end}" The above code achieves the drop-down time, the original content is not emptied ELSE End if Svr.connect "ServerName", "Uerid", "PWD" '3 quotes, the server name, username, respectively , Password for i = 1 to svr.databases.count combo1.additem Svr.databases (i) .name nextend SUB original question: http://community.9cbs.net/expert/topic/3372/3372347.xml? Temp = .9784357 (Note: Super ... is me)

转载请注明原文地址:https://www.9cbs.com/read-56665.html

New Post(0)