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

📄 数据库备份.txt

📁 基于C++编写的用于移动电话的计费系统可以完成日常计费系统的需要
💻 TXT
字号:
Begin VB.Form FrmBackUp 
   BackColor       =   &H00E7DFE7&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "备份数据库"
   ClientHeight    =   1695
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4680
   Icon            =   "数据库备份.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   1695
   ScaleWidth      =   4680
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   495
      Left            =   2640
      TabIndex        =   3
      Top             =   840
      Width           =   1455
   End
   Begin VB.CommandButton cmdBackUp 
      Caption         =   "备份"
      Height          =   495
      Left            =   600
      TabIndex        =   2
      Top             =   840
      Width           =   1455
   End
   Begin VB.Label lbTime 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Height          =   180
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "单击“备份”按钮,开始备份数据库。"
      Height          =   180
      Left            =   240
      TabIndex        =   0
      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 fso As New FileSystemObject, fldr As Folder
Dim cn As ADODB.Connection
Dim success As Long


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 = "电话计费管理系统" & NowTime
sql = "BACKUP DATABASE 电话计费管理系统 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()
FrmBackUp.Hide
MDIForm1.Show
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 + -