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

📄 frmbackup.frm

📁 学生管理系统,vb+acc开发的一个简单程序
💻 FRM
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Begin VB.Form FrmBackUp 
   BackColor       =   &H00E7DFE7&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "备份数据库"
   ClientHeight    =   1695
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   Icon            =   "FrmBackUp.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   1695
   ScaleWidth      =   4680
   Begin SmartXPButton.XpButton cmdBackUp 
      Height          =   495
      Left            =   1560
      TabIndex        =   0
      Top             =   960
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   873
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "备份(&B)"
      CaptionMouseOverColor=   16711680
      PictureBackColor=   15790320
      PictureSmoothBackColor=   15790320
      ButtonPicture   =   "FrmBackUp.frx":038A
   End
   Begin SmartXPButton.XpButton cmdExit 
      Height          =   495
      Left            =   3120
      TabIndex        =   1
      Top             =   960
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   873
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "关闭(&E)"
      CaptionMouseOverColor=   16711680
      PictureBackColor=   15790320
      PictureSmoothBackColor=   15790320
      ButtonPicture   =   "FrmBackUp.frx":0724
   End
   Begin VB.Label lbTime 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Height          =   180
      Left            =   240
      TabIndex        =   3
      Top             =   720
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "单击“备份”按钮,开始备份数据库。"
      Height          =   180
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   3060
   End
End
Attribute VB_Name = "FrmBackUp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As ADODB.Connection
Dim success As Long
Dim fso As New FileSystemObject, fldr As Folder

Private Sub cmdBackUp_Click()
Dim backFile As String
Dim NowTime As String
Dim sql As String
Dim buff As String
If fso.FolderExists(App.Path & "\BackUp") = False Then
    Set fldr = fso.CreateFolder(App.Path & "\BackUp")
End If
NowTime = Format(Now, "yyyy-mm-dd_hh-mm-ss")
backFile = "Sims_four" & NowTime
sql = "BACKUP DATABASE Sims_four TO disk='" & App.Path & "\BackUP\" & backFile & "'"
cn.Execute (sql)
MsgBox "数据库备份成功!" & vbCrLf & "文件:" & backFile, vbOKOnly + vbInformation, "备份数据库"
success = WritePrivateProfileString("BackUp", "NewFile", backFile, App.Path & "\Sims.ini")

buff = String(255, 0)
ret = GetPrivateProfileString("BackUp", "Time", "1", buff, 256, App.Path & "\Sims.ini")
lbTime.Caption = buff
Select Case lbTime.Caption
Case "1"
success = WritePrivateProfileString("BackUp", "File1", backFile, App.Path & "\Sims.ini")
Case "2"
success = WritePrivateProfileString("BackUp", "File2", backFile, App.Path & "\Sims.ini")
Case "3"
success = WritePrivateProfileString("BackUp", "File3", backFile, App.Path & "\Sims.ini")
Case "4"
success = WritePrivateProfileString("BackUp", "File4", backFile, App.Path & "\Sims.ini")
Case "5"
success = WritePrivateProfileString("BackUp", "File5", backFile, App.Path & "\Sims.ini")
End Select
lbTime.Caption = lbTime.Caption + 1
If lbTime.Caption = 6 Then
   lbTime.Caption = 1
End If
success = WritePrivateProfileString("BackUp", "Time", lbTime.Caption, App.Path & "\Sims.ini")
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub Form_Load()
Set cn = New ADODB.Connection
If cn.State = adStateOpen Then cn.Close
With cn
    .ConnectionTimeout = 10
    .Provider = "sqloledb"
    .ConnectionString = "data source=.;initial catalog=master;user id=sa;password=;"
    .Open
End With
End Sub

⌨️ 快捷键说明

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