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")

相关文章:

  • 2022-02-01
  • 2022-12-23
  • 2021-07-09
  • 2021-09-16
  • 2021-07-05
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2022-02-19
  • 2021-08-22
  • 2021-12-08
  • 2021-12-06
  • 2022-01-13
相关资源
相似解决方案