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

📄 frmrestore.frm

📁 一个用VB写的财务软件源码
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmRestore 
   Caption         =   "数据恢复"
   ClientHeight    =   1485
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4620
   Icon            =   "frmRestore.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   1485
   ScaleWidth      =   4620
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "确定(&O)"
      Height          =   375
      Left            =   750
      TabIndex        =   5
      Top             =   1020
      Width           =   1095
   End
   Begin VB.Frame Frame2 
      Height          =   855
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   4575
      Begin VB.TextBox TxtFileName 
         Height          =   270
         Left            =   1080
         TabIndex        =   3
         Top             =   360
         Width           =   2535
      End
      Begin VB.CommandButton CmdBrowse 
         Caption         =   "浏览"
         Height          =   300
         Left            =   3720
         TabIndex        =   2
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label4 
         Caption         =   "备份文件名"
         Height          =   375
         Left            =   120
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   " 返回(&Q)"
      Height          =   375
      Left            =   2640
      TabIndex        =   0
      Top             =   990
      Width           =   1095
   End
   Begin MSComDlg.CommonDialog CommonOpen 
      Left            =   4080
      Top             =   960
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      DefaultExt      =   "dat"
      DialogTitle     =   "打开"
      Filter          =   "*.dmp"
      InitDir         =   "c:\"
   End
End
Attribute VB_Name = "frmRestore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdBrowse_Click()
    Dim i As Integer
    
    CommonOpen.filename = TxtFileName
    CommonOpen.InitDir = "c:\"
    CommonOpen.ShowOpen
    
    
    If Trim(CommonOpen.filename) = "" Then
    Else
    i = InStr(1, CommonOpen.filename, ".", vbTextCompare)
    
         If Mid(CommonOpen.filename, i + 1, 3) <> "dmp" And Mid(CommonOpen.filename, i + 1, 3) <> "DMP" Then
            TxtFileName = Mid(CommonOpen.filename, 1, i) & "dmp"
         Else
            TxtFileName = CommonOpen.filename
         End If
    End If
End Sub


Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
    If TxtFileName = "" Then
       MsgBox "文件名不能为空!", vbOKOnly, "提示"
'       TxtServerName.SetFocus
       Exit Sub
    Else
       i = InStr(1, TxtFileName.text, ".", vbTextCompare)
       If i = 0 Then
          MsgBox "文件扩展名必须为.dat!", vbOKOnly, "提示"
          TxtFileName.SetFocus
          TxtFileName.SelStart = 0
          TxtFileName.SelLength = Len(TxtFileName.text)
          Exit Sub
       Else
          If Mid(TxtFileName.text, i + 1, 3) <> "dat" And Mid(TxtFileName.text, i + 1, 3) <> "DAT" Then
             MsgBox "文件扩展名必须为.dat!", vbOKOnly, "提示"
             TxtFileName.SetFocus
             TxtFileName.SelStart = 0
             TxtFileName.SelLength = Len(TxtFileName.text)
             Exit Sub
           End If
        End If
       End If
On Error GoTo errorhandle:
    Dim cmd As ADODB.Command
    Set cmd = New ADODB.Command
    cmd.ActiveConnection = gloSys.cnnSys
    cmd.CommandText = "RESTORE DATABASE MyNwind  From disk='" & Trim(TxtFileName.text) & "'"
    cmd.Execute
    MsgBox "备份完成!", vbInformation, "提示"
    Exit Sub
errorhandle:
     MsgBox "备份出错!", vbInformation, "提示"
     Exit Sub
     
End Sub

⌨️ 快捷键说明

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