📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4695
ClientLeft = 60
ClientTop = 450
ClientWidth = 7830
LinkTopic = "Form1"
ScaleHeight = 4695
ScaleWidth = 7830
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox List1
Height = 3300
Left = 1440
TabIndex = 1
Top = 360
Width = 3135
End
Begin VB.CommandButton Command1
Caption = "列出"
Height = 375
Left = 2280
TabIndex = 0
Top = 3960
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim oAppliction As New SQLDMO.Application
Dim oNameList As SQLDMO.NameList
Dim i As Integer
Dim strOldServer As String
On Error Resume Next
Screen.MousePointer = vbHourglass
'保存旧数据
strOldServer = cboServerName
Err.Clear
'列出可以使用的SQL Server实例
Set oNameList = oAppliction.ListAvailableSQLServers
'如果正确则列出
If Err.Number = 0 Then
'如果有可以利用的SQL Server实例
If oNameList.Count >= 1 Then
'添加到下拉列表框中
With List1
.Clear
For i = 1 To oNameList.Count
.AddItem oNameList.Item(i)
Next i
'恢复旧数据
.Text = strOldServer
End With
End If
End If
'断开连接,并释放对象
oAppliction.Quit
Set oAppliction = Nothing
Screen.MousePointer = vbDefault
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -