⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 这是一个VB开发的
💻 FRM
字号:
VERSION 5.00
Begin VB.Form mainForm 
   Caption         =   "数据备份"
   ClientHeight    =   3075
   ClientLeft      =   60
   ClientTop       =   465
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3075
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.OptionButton Option2 
      Caption         =   "自动备份"
      Height          =   375
      Left            =   810
      TabIndex        =   6
      Top             =   1320
      Width           =   1035
   End
   Begin VB.OptionButton Option1 
      Caption         =   "手动备份"
      Height          =   525
      Left            =   810
      TabIndex        =   5
      Top             =   690
      Width           =   1245
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   435
      Left            =   2940
      TabIndex        =   4
      Top             =   1350
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Caption         =   "备份方式"
      Height          =   2355
      Left            =   210
      TabIndex        =   2
      Top             =   180
      Width           =   4485
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   435
         Left            =   2760
         TabIndex        =   3
         Top             =   510
         Width           =   1455
      End
   End
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   240
      Top             =   2640
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   810
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   2640
      Width           =   885
   End
   Begin VB.Label Label1 
      Caption         =   "Label1"
      Height          =   525
      Left            =   2010
      TabIndex        =   0
      Top             =   2550
      Width           =   1245
   End
End
Attribute VB_Name = "mainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim kkk As String
Dim old_time As Date, new_time As Date
Dim X

Dim settingTime As Integer


Private Sub Command1_Click()
On Error GoTo kkk
Dim settingTimeString As String
settingTimeString = InputBox("请输入备份间隔的时间天数(默认30天):", "数据备份", "30")
settingTime = settingTimeString
MsgBox ("设置成功!")

Exit Sub
kkk:
   
    MsgBox ("请输入正确天数!")
End Sub

'Private Sub Command2_Click()
'zzz = frestoredatabase_a("E:\job_DB\vb_example1\789", "HmYKT", "E:\job_DB\vb_example1\", 1, False)
'zzz = frestoredatabase_a("E:\job_DB\vb_example1\789", "HmYKT", "E:\job_DB\vb_example1\", 1, True)
'End Sub
'
  Private Sub Command2_Click()
  Dim conn     As New ADODB.Connection
  Dim strSql     As String
  Dim strConn     As String
  Dim fileName     As String

  On Error GoTo errEnd
'  strConn = "driver={sql server};server=vxxy;uid=sa;pwd="
  strConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=vxxy"
  conn.Open strConn
  strSql = "RESTORE   DATABASE   HmYKT   FROM   DISK='E:\job_DB\vb_example1\" & CStr(Format(Date, "yyyy-mm-dd")) & ".bak'"
  Label1.Visible = True
  Label1.Caption = "正在恢复数据库,请稍侯......"
  DoEvents
  conn.Execute strSql
  DoEvents
  Label1.Caption = ""
  DoEvents
  conn.Close
  Set conn = Nothing
  MsgBox "导入本机数据库完成!", vbOKOnly Or vbInformation, "导入成功"
  Exit Sub

errEnd:
  Label1.Caption = ""
  MsgBox Err.Description, vbInformation, "Error"
  conn.Close
  Set conn = Nothing
  Exit Sub
  End Sub

Private Sub Form_Load()
old_time = Date
settingTime = 30
Label1.Caption = old_time
Option1.Value = False
Option2.Value = True
End Sub



Private Sub Timer1_Timer()

Text1.Text = ""
new_time = Date
If new_time - old_time >= settingTime Then
Text1.Text = "哈哈,时间到!"
fBack = fBackupDatabase_a("E:\vxxy555", "HmYKT")
MsgBox fBack
old_time = Date
End If


End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -