📄 sqlfrm.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form SqlFrm
BorderStyle = 1 'Fixed Single
Caption = "SQL连接"
ClientHeight = 5655
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
Icon = "SqlFrm.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 5655
ScaleWidth = 4680
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Caption = "SQL连接工具"
Height = 5655
Left = 0
TabIndex = 0
Top = 0
Width = 4695
Begin VB.Timer Timer1
Interval = 50
Left = 1320
Top = 4200
End
Begin RichTextLib.RichTextBox txtResult
Height = 2655
Left = 120
TabIndex = 18
Top = 2880
Width = 4455
_ExtentX = 7858
_ExtentY = 4683
_Version = 393217
ScrollBars = 2
TextRTF = $"SqlFrm.frx":030A
End
Begin VB.TextBox txtSql
Appearance = 0 'Flat
Height = 375
Left = 1080
TabIndex = 17
Top = 1360
Width = 3540
End
Begin VB.Frame Frame2
Caption = "开启3389"
Height = 975
Left = 120
TabIndex = 10
Top = 1760
Width = 4455
Begin VB.CommandButton cmd5
Caption = "第五步"
Height = 495
Left = 3480
TabIndex = 15
Top = 240
Width = 855
End
Begin VB.CommandButton cmd4
Caption = "第四步"
Height = 495
Left = 2640
TabIndex = 14
Top = 240
Width = 855
End
Begin VB.CommandButton cmd3
Caption = "第三步"
Height = 495
Left = 1800
TabIndex = 13
Top = 240
Width = 855
End
Begin VB.CommandButton cmd2
Caption = "第二步"
Height = 495
Left = 960
TabIndex = 12
Top = 240
Width = 855
End
Begin VB.CommandButton cmd1
Caption = "第一步"
Height = 495
Left = 120
TabIndex = 11
Top = 240
Width = 855
End
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "SqlFrm.frx":0631
Left = 120
List = "SqlFrm.frx":063B
TabIndex = 9
Text = "使用XP_CMDSHELL执行命令"
Top = 960
Width = 3255
End
Begin VB.CommandButton cmdExecute
Caption = "执行命令"
Height = 375
Left = 3400
TabIndex = 8
Top = 960
Width = 1215
End
Begin VB.CommandButton cmdConn
Caption = "开始连接"
Height = 375
Left = 3400
TabIndex = 7
Top = 560
Width = 1215
End
Begin VB.TextBox txtIP
Appearance = 0 'Flat
Height = 270
Left = 960
TabIndex = 6
Top = 600
Width = 2415
End
Begin VB.TextBox txtPass
Appearance = 0 'Flat
Height = 270
Left = 2880
TabIndex = 4
Top = 240
Width = 1695
End
Begin VB.TextBox txtSa
Appearance = 0 'Flat
Height = 270
Left = 960
TabIndex = 2
Text = "sa"
Top = 240
Width = 1335
End
Begin VB.Label Label4
Caption = "cmd命令"
Height = 240
Left = 120
TabIndex = 16
Top = 1440
Width = 855
End
Begin VB.Label Label3
Caption = "IP地址"
Height = 255
Left = 120
TabIndex = 5
Top = 600
Width = 735
End
Begin VB.Label Label2
Caption = "密码"
Height = 255
Left = 2400
TabIndex = 3
Top = 240
Width = 495
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 855
End
End
End
Attribute VB_Name = "SqlFrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const TitleInfo As String = "程序制作红色银狐"
Public Conn As New ADODB.Connection
Public Rs As New ADODB.Recordset
'--------------------------------------------------------------------------------------------------
'开始连接
'--------------------------------------------------------------------------------------------------
Private Sub cmdConn_Click()
On Error GoTo DisplayErr
Dim sIP As String, sUserName As String, sUserPass As String
Dim sCaption As String
sCaption = cmdConn.Caption
Select Case sCaption
Case "开始连接"
cmdConn.Caption = "断开连接"
sIP = txtIP.Text
sUserName = txtSa.Text
sUserPass = txtPass.Text
If CheckIP(sIP) = False Then
MsgBox "输入IP地址不正确", vbExclamation, TitleInfo
txtIP.SetFocus
cmdConn.Caption = "开始连接"
Exit Sub
End If
Call Connect(sIP, sUserName, sUserPass)
If Conn.State = 1 Then
txtResult.Text = ""
txtResult.Text = "已经连接成功"
End If
cmdExecute.Enabled = True
Case "断开连接"
cmdConn.Caption = "开始连接"
txtResult.Text = ""
If Conn.State = 1 Then
Conn.Close
Set Conn = Nothing
txtResult.Text = txtResult.Text & "已经断开连接" & vbCrLf
End If
End Select
Exit Sub
DisplayErr:
MsgBox Err.Description, vbCritical, TitleInfo
Set Conn = Nothing
cmdConn.Caption = "开始连接"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -