📄 dialognewdevice.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "richtx32.ocx"
Begin VB.Form DialogNewDevice
BorderStyle = 3 'Fixed Dialog
Caption = "new device"
ClientHeight = 2160
ClientLeft = 5775
ClientTop = 4980
ClientWidth = 6015
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2160
ScaleWidth = 6015
ShowInTaskbar = 0 'False
Begin VB.TextBox Text2
Height = 375
Left = 3120
Locked = -1 'True
TabIndex = 5
Top = 360
Width = 1695
End
Begin RichTextLib.RichTextBox RichTextBox1
Height = 495
Left = 1800
TabIndex = 4
Top = 1680
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 873
_Version = 393217
TextRTF = $"DialogNewdevice.frx":0000
End
Begin VB.CommandButton OKButton
Caption = "确定"
Height = 375
Left = 1440
TabIndex = 1
Top = 1200
Width = 1215
End
Begin VB.CommandButton CancelButton
Caption = "取消"
Height = 375
Left = 3960
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "..."
Height = 375
Left = 5040
TabIndex = 0
Top = 360
Width = 495
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 480
Top = 1680
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "sql 备份文件(*.bak)|*.bak|所有文件(*.*)|*.*"
End
Begin VB.Label Label2
Caption = "请选择新建备份设备的路径:"
Height = 255
Left = 480
TabIndex = 2
Top = 480
Width = 2415
End
End
Attribute VB_Name = "DialogNewDevice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim fname As String
Dim sfile As String
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub Command1_Click()
Dim result As String
With CommonDialog1
.DialogTitle = "备份"
.CancelError = False
.Filter = "sql 备份文件(*.bak)|*.bak|所有文件(*.*)|*.*"
'ToDo: 设置 common dialog 控件的标志和属性
.ShowSave
If Len(.FileName) = 0 Then
Exit Sub
End If
sfile = .FileName
End With
Me.Text2.Text = sfile
Dim start As Integer
start = 1
While InStr(start + 1, sfile, "\", vbTextCompare) <> 0
start = InStr(start + 1, sfile, "\", vbTextCompare)
Wend
fname = Right$(sfile, Len(sfile) - start)
fname = Left$(fname, Len(fname) - 4)
End Sub
Private Sub OKButton_Click()
Dim result As String
If Me.Text2.Text = "" Then
result = MsgBox("请选择路径", 0, "错误信息")
Else
Dim v As Integer
Dim command As String
command = "exec sp_addumpdevice N'disk',N'" + fname + "',N'" + Me.Text2.Text + "'"
v = MsgBox(command + Chr(13) + Chr(10) + "是否运行该操作?", 1, "single sql operation")
If v = 1 Then
Me.MousePointer = 11 '改变鼠标样子
RichTextBox1.SaveFile sfile, 1
Dim scom As ADODB.command
Set scom = New ADODB.command
scom.ActiveConnection = adoconn
scom.CommandText = command
On Error GoTo serr
scom.Execute , , 1
Me.MousePointer = 0 '改变鼠标样子
MsgBox " successfully complete!!!", 0
Unload Me
End If
End If
Exit Sub
serr:
MsgBox err.Description, 0, "错误信息"
Me.MousePointer = 0 '改变鼠标样子
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -