用asp.net在线备份SQL-Server数据库

1:要用到SQL-SERVER里面的Sqldmo来做这个工作,找到Sqldmo.dll这个文件,在C:/program files/microsoft Sql server
/80/Tools/binn/Sqldmo.dll
用.net框架提供的工具转达成受托管代码(工具为:vs.net命令提示)
tlbimp sqldmo.dll /out: c:/sqldmo.dll
2:引用Sqldmo.dll文件(imports sqldmo)
3: Dim oBackup As sqldmo.Backup = New sqldmo.BackupClass
        Dim oSqlServer As sqldmo.SQLServer = New sqldmo.SQLServerClass
        oSqlServer.LoginSecure = False
        oSqlServer.Connect("luohua", "sa", "密码")
        oBackup.Action = SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
        oBackup.Database = "数据库"
        oBackup.Files = "d:/jnszf.bak"
        oBackup.BackupSetName = "数据库"
        oBackup.BackupSetDescription = "数据库备份"
        oBackup.Initialize = True
        oBackup.SQLBackup(oSqlServer)
        oSqlServer.DisConnect()
        Dim fi As System.IO.FileInfo = New System.IO.FileInfo("d:/jnszf.bak")

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页