Dim StrCnn As New Connection
Dim itmX As ListItem
Dim key, list, SQL As String
Private Sub Command2_Click ()
End
End Sub
Private Sub Form_Load ()
Option1. Value=https://bbs.csdn.net/topics/True
Dir1_Change
End Sub
Private Sub Dir1_Change ()
File1. Path=dir1-name. Path
ListView1. ListItems. Clear
If File1. ListCount & lt;> 0 Then
A=0
The Do While File1. ListIndex & lt; File1. ListCount - 1
File1. ListIndex=a
Key=File1. FileName
The Set itmX=ListView1. ListItems. Add (,, key, 1)
A=a + 1
Loop
End the If
File1_click
End Sub
Private Sub Drive1_change ()
The dir1-name. Path=Drive1. Drive
End Sub
Private Sub File1_click ()
Label2. Caption=dir1-name. Path & amp; "" & amp; File1. FileName
End Sub
Private Sub ListView1_Click ()
Label2. Caption=dir1-name. Path & amp; "" & amp; ListView1. SelectedItem
End Sub
Private Sub Command1_Click ()
Dim s
If Option1. Value=https://bbs.csdn.net/topics/True Then
S=dir1-name. Path & amp; "" & amp; The Date & amp; "BAK"
If Label2. Caption=s Then
MsgBox "data backup card already exists!"
The Else
StrCnn. Open "the Provider=MSDASQL. 1; Persist Security Info=False; User ID=sa; Data Source=Backup "
SQL="backup DATABASE FDCPGGL TO disk='" & amp; S & amp; "'
"StrCnn. Execute (SQL) 'debugging to this
StrCnn. Close
MsgBox "database backup success!"
Key=Date & amp; "BAK"
The Set itmX=ListView1. ListItems. Add (,, key, 1)
End the If
End the If
If Option2. Value=https://bbs.csdn.net/topics/True Then
If File1. ListCount & lt;> 0 Then
If Label2. Caption & lt;> "" Then
StrCnn. Open "the Provider=MSDASQL. 1; Persist Security Info=False; User ID=sa; Data Source=Backup "
SQL="RESTORE DATABASE FDCPGGL FROM disk='" & amp; Label2. Caption & amp; "'
"StrCnn. Execute (SQL)
StrCnn. Close
MsgBox "database recovery success!"
The Else
MsgBox "please choose to restore the data backup card!"
End the If
The Else
MsgBox "please choose to restore the data backup card!"
End the If
End the If
End Sub
CodePudding user response:
FileThe dir1-name. Path & amp; "" & amp; The Date & amp; "BAK"
There is no
CodePudding user response:
File directory exists such a fileCodePudding user response:
Are A) BACKUP the DATABASE on the server, you native path is invalid,B) even if the database to run in the machine, it start the user and the current user is not the same as you, access to the directory permissions problems also, had better set directory rights for everyone fully control,
CodePudding user response:
S=dir1-name. Path & amp; "" & amp; "Real estate appraisal management system database" & amp; ". MDF "I will be changed after the place above, the backup is successful,
But again wrong, prompt restore to handle DATABASE 'FDCPGGL', because it is FROM this session using, suggest to perform this operation is used when the master DATABASE, I will have this to SQL="restore the DATABASE master FROM disk='" & amp; Label2. Caption & amp; "'
"But if prompt to restore the master database, the server must be in single user mode,
CodePudding user response:
'you configure the Backup data source, don't set to the default database FDCPGGL, but want to use other databases (such as a master)'
StrCnn. Open "the Provider=MSDASQL. 1; Persist Security Info=False; User ID=sa; Data Source=Backup "
'otherwise FDCPGGL after connection is used, is cannot make the recovery'
SQL="RESTORE DATABASE FDCPGGL FROM disk='" & amp; Label2. Caption & amp; "'"
CodePudding user response:
After I according to what you said, no this hint, but suggest the media set has 2 media clusters, but only provides a, all members must be provided,