怎么实现数据库备份文件的恢复呢?
想实现任意bs端选择数据库备份文件之后,直接运行数据库备份文件,然后恢复数据到数据库服务器中
当前代码如下:【可以实现数据库从服务器备份数据到bs端打开的任意电脑指定目录下】
If FileSys.DirectoryExists("D:\SQL_Backup") Then '如果目录C:\MyFolder存在
Dim cmd As New SQLCommand
cmd.C
Dim time As String =Format(Date.now,"yyyyMMddHHmmss")
Dim mdf As String = "综合业务系统"
cmd.CommandText = "use master;BACKUP DATABASE [" & mdf & "] To DISK = 'D:\SQL_Backup\" & mdf & "_" & time & ".bak';"
cmd.ExecuteNonQuery
Else
FileSys.CreateDirectory("D:\SQL_Backup")
Dim cmd As New SQLCommand
cmd.C
Dim time As String =Format(Date.now,"yyyyMMddHHmmss")
Dim mdf As String = "综合业务系统"
cmd.CommandText = "use master;BACKUP DATABASE [" & mdf & "] To DISK = 'D:\SQL_Backup\" & mdf & "_" & time & ".bak';"
cmd.ExecuteNonQuery
End If