📄 frmshujubeifen.frm
字号:
VERSION 5.00
Begin VB.Form frmshujubeifen
BorderStyle = 1 'Fixed Single
Caption = "数据备份"
ClientHeight = 2070
ClientLeft = 45
ClientTop = 420
ClientWidth = 6525
ControlBox = 0 'False
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2070
ScaleWidth = 6525
Begin VB.CommandButton cmdexit
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 2
Top = 1440
Width = 3015
End
Begin VB.CommandButton cmdOK
Caption = "确认"
Height = 495
Left = 120
TabIndex = 1
Top = 1440
Width = 3015
End
Begin VB.Label Label1
Caption = "注意:为了保证数据的完整性,请在确认其他用户退出的情况下执行本操作。"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 660
Left = 240
TabIndex = 0
Top = 360
Width = 6120
End
End
Attribute VB_Name = "frmshujubeifen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim cpmasterconn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim msqlmaster As String, rq As String, s2 As String
rq = Format(Date, "yyyymmdd") & Format(Time, "hhmm")
msqlmaster = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Roso;Data Source=(local)"
cpmasterconn.CursorLocation = adUseClient
cpmasterconn.CommandTimeout = 0
cpmasterconn.Open msqlmaster
If MsgBox("您确认要备份数据吗(Y/N)?", vbYesNo + vbQuestion + vbDefaultButton2, "提示") = 7 Then Exit Sub
Me.MousePointer = vbHourglass
Set rs = cpmasterconn.Execute("select * from master.dbo.sysdevices where name='kaojuan" & rq & "备份'")
If rs.RecordCount = 0 Then
cpmasterconn.Execute "sp_addumpdevice 'disk','kaojuan" & rq & "备份','E:\kaojuan" & rq & "备份'"
End If
rs.Close
cpmasterconn.Execute "BACKUP DATABASE Roso TO kaojuan" & rq & "备份"
Me.MousePointer = vbDefault
MsgBox "数据备份完毕!", vbInformation, "提示"
cpmasterconn.Close
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -