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

📄 frm_restore.frm

📁 图书管理系统,图书信息,添加学生信息,借书与归还记载,借书卡办理,查询图书信息
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frm_restore 
   Caption         =   "数据恢复"
   ClientHeight    =   2205
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3690
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2205
   ScaleWidth      =   3690
   StartUpPosition =   3  '窗口缺省
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   510
      Top             =   2640
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   120
      Top             =   4560
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa"
      OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from tb_enter"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.TextBox Text3 
      Height          =   270
      Left            =   3120
      TabIndex        =   2
      Text            =   "Text3"
      Top             =   5400
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2250
      TabIndex        =   0
      Top             =   1695
      Width           =   1095
   End
   Begin VB.CommandButton Cmd_Ok 
      Caption         =   "开始恢复"
      Height          =   375
      Left            =   1095
      TabIndex        =   1
      Top             =   1695
      Width           =   1095
   End
   Begin VB.Frame Frame2 
      Height          =   1530
      Left            =   75
      TabIndex        =   3
      Top             =   120
      Width           =   3270
      Begin VB.TextBox Txt_restore 
         Height          =   300
         Left            =   120
         TabIndex        =   5
         Top             =   645
         Width           =   2655
      End
      Begin VB.CommandButton Cmd_select 
         Caption         =   "<<"
         Height          =   300
         Left            =   2745
         TabIndex        =   4
         Top             =   660
         Width           =   375
      End
      Begin VB.Label Label2 
         Caption         =   "选择数据库恢复的路径"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         Left            =   135
         TabIndex        =   6
         Top             =   315
         Width           =   2415
      End
   End
End
Attribute VB_Name = "frm_restore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim xx As String
Dim cn     As New ADODB.Connection, rs    As New ADODB.Recordset
Private Sub Cmd_Ok_Click()
If Txt_restore.Text = "" Then
   MsgBox "请您选择数据库恢复的路径!", 64, "提示信息"
Else
    Me.MousePointer = 11
    Cmd_Ok.Enabled = False
    xx = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=(local)"     '借助master数据库来恢复
    cn.ConnectionString = xx
    cn.CursorLocation = adUseClient
    cn.Open
    rs.Open "select   spid   from   sysprocesses   where   dbid=db_id('tshgl')", cn
    Do While Not rs.EOF
        cn.Execute "kill     " & rs("spid")             '杀掉sql服务器的所有连接,否则会出现:数据库正在使用,无法完成排它操作等等,很重要
        rs.MoveNext
    Loop
    cn.Execute ("restore   database   tshgl  from   disk='" & Txt_restore.Text & "'   with   replace")
    cn.Close
    MsgBox "数据库恢复成功!!", 64, "提示信息"
    Cmd_Ok.Enabled = True
    Me.MousePointer = 0
End If
End Sub

Private Sub Cmd_select_Click()
CommonDialog1.Filter = "备份文件(*.bak)|*.bak|文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog1.ShowOpen
Txt_restore.Text = CommonDialog1.FileName
End Sub

Private Sub Cmd_Cancel_Click()
Unload Me
End Sub

Private Sub Form_Load()
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
End Sub

⌨️ 快捷键说明

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