0

Help please!!!! Is there anyone has a sample code on how to call the backup and restore of SLQ server using VB6. I already have it but, unfortunately the backend of my program is Ms access and I want it to use as SQL server. Any help is highly appreciated....


Thanks,


Jacsme

3
Contributors
4
Replies
6
Views
11 Years
Discussion Span
Last Post by abu taher
0

You would be better off using SQL server utilities for backup and restore, You could probably build a DTS package to perform the operation for you.

0

what is a DTS package anyway..??? i have a project that we're using sql server. and that project has a menu to backup the database. and it should automatically backup the database same with restore. but manually, the sql server has its own backup menu, but the thing is we dont want the user to do it manually that is why we need it to put a code for that back up.

Jacsme

0

DTS - Data Transformation Services
It ships with SQL Server since version 7, it can be used for a number of tasks including moving large volumes of data around and backing up databases. You can also schedule DTS packages from within SQL Server Enterprise Manager.

Have a look here for some more info

http://www.sqldts.com/

0

plz check it.

Attachments
'restore database
Option Explicit
Dim CommondialogControl As Control

Sub RestoreDbase(CommondialogControl, StrSource As String)
    'Ask the filename of Back-Up
    CommondialogControl.Filter = "Back-Up Files(*.mdb)|*.mdb"
    'Set a deafault DIR
    CommondialogControl.InitDir = "C:\"
    'Display the Open Dialog Window
    CommondialogControl.ShowOpen
    
   On Error GoTo Opps
   'if  there is a filename selected
   If CommondialogControl.FileName <> "" Then
        'overwrites the existing Back-Up Files w/ the Copied One
'''''''''Overwrites strSource with CommondialogControl.Filename
         FileCopy CommondialogControl.FileName, StrSource
        'display the path and filename of database
        'Text1.Text = CommondialogControl.FileName
        'prompt to user that Restoration is successful...
        MsgBox "Restore Complete!", vbInformation, "RESTORE SUCCESSFUL"
   End If
   Exit Sub
   
Opps:
    MsgBox Err.Description, vbExclamation, " "
   
End Sub
'*******************************************************************

'Backup database
Option Explicit
Dim CommondialogControl As Control

Sub BackUpDBase(CommondialogControl, StrSource As String)

    'CommondialogControl = CommondialogControl
    'Ask the filename of Back-Up
    CommondialogControl.Filter = "Back-Up Files (*.mdb)|*.mdb"
    'Set Default DIR
    CommondialogControl.InitDir = "C:\"
    'Display the SHOWSAVE window
    CommondialogControl.ShowSave

  On Error GoTo Opps
 'If there is an entry
 If CommondialogControl.FileName <> "" Then
    'if already exist then delete the file
    If Dir(CommondialogControl.FileName) <> "" Then Kill CommondialogControl.FileName
    
   ' 'repair database
   '' DBEngine.RepairDatabase "C:\Documents and Settings\allen\Desktop\mitch-barcode\monitoringdbCon.mdb"
    
    FileCopy StrSource, CommondialogControl.FileName
    'Text1.Text = CommondialogControl.FileName
    'Prompt to User that Back_Up is Completed
    MsgBox "Back-Up Complete!", vbInformation, "BACK-UP SUCCESSFUL"
 End If
    Exit Sub
    
Opps:
    MsgBox Err.Description, vbExclamation, "Employee Status System"
    
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.