Howdy, Stranger!

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

Categories

sql backup

wajahatwajahat Member Posts: 24
hi
how to backup and restore SQL Server database by using VB6.
thankx

Comments

  • ShanooShanoo Member Posts: 32
    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.