Backup and Restore SQL database with

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Backup and Restore SQL database with

  1. #1
    Join Date
    Mar 2005

    Backup and Restore SQL database with

    I have the following code:
    Dim oSQLServer As New SQLDMO.SQLServer
    Dim oBackup As New SQLDMO.Backup
    Dim oRestore As New SQLDMO.Restore
    Dim BACKUPFILE As String
    Dim DATABASE As String
    BACKUPFILE = "C:\VoicenetSQL\project\tampa\Politic\" & ProjectFolder & "\VoiceNet_TemplateBackup.bkp"
    DATABASE = "VoiceNet_at0000"
    With oBackup
                .Files = BACKUPFILE
                .Database = DATABASE
                .BackupSetName = "VoiceNet"
                .BackupSetDescription = "Backup from VB.NET application"
                .oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
            End With
    This is not working. I am getting the following error:
    "Public member 'oSQLServer' on type 'BackupClass' not found."

    Does anyone know how to accomplish this?


  2. #2
    Join Date
    Nov 2003
    Portland, OR
    Let IntelliSense help you: Inside your "With oBackup" block, press the period (.) key, and look at the dropdown list of properties and methods. You'll find that there is not one called "oSQLServer," which is why you're getting the error. I suspect that you intend to call oSQLServer.Connect directly, without the preceding period.
    Phil Weber

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2005
    I got that working. I needed to move the oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser") out of the with statement.

    I am now having an issue with the restore.

    I have a db called Voicenet_Template (this is the db I backed up).
    Now I'd like to restore the backup, but with a different database name and therefore different log and mdf files.

    The backup file is for db Voicenet_Template which has log(Voicenet_Template_log.ldf) and data files (Voicenet_Template.mdf).

    The new db should be Voicenet_ABC and log and mdf files Voicenet_ABC_log.ldf and Voicenet_ABC.mdf

    Do you know how I can do this?


Similar Threads

  1. SQL Server Restore from Diff backup
    By Raj in forum Database
    Replies: 0
    Last Post: 03-31-2003, 10:23 PM
  2. SQL Database Backup
    By Jeremiahb in forum Database
    Replies: 2
    Last Post: 01-10-2002, 05:47 AM
  3. Restoring sql 6.5 database backup
    By impulse24 in forum Database
    Replies: 0
    Last Post: 01-02-2002, 06:36 PM
  4. Backup & Restore Full Database
    By Bill Lunney in forum Database
    Replies: 2
    Last Post: 09-15-2000, 04:08 AM
  5. How to restore a NON BACKUP Database.
    By Manuel De Leon in forum Database
    Replies: 2
    Last Post: 05-31-2000, 09:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center