sql backup

how to backup and restore SQL Server database by using VB6.


  • Hi,

    Add SQLDMO in references and use the following code:

    Dim Srv As SQLServer
    Dim Bkp As Backup

    Set Srv = New SQLServer

    Srv.LoginSecure = True
    Srv.Connect "MyServer"

    ' Srv.Connect "MyServer", "MyLogin", "MyPassword"

    Set Bkp = New Backup
    Bkp.Database = "Test"
    Bkp.Files = "C:Test.bak"
    Bkp.Action = SQLDMOBackup_Database
    Bkp.SQLBackup Srv

    - HTH
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion