Compare SQL Native Backup to LiveDatabase

rockywurdenrockywurden Posts: 10
edited December 12, 2007 4:02AM in SQL Toolkit Previous Versions
I can compare 2 databases.
What do I need to change DB1 to a SQL Backup file?
Thanks


Imports RedGate.SQL.Shared
Imports RedGate.SQLCompare.Engine
Imports RedGate.SQLDataCompare.Engine
Imports RedGate.SQLDataCompare.Engine.ResultsStore
Imports RedGate.SQLCompare.BackupReader

Dim db1 As New Database
Dim db2 As New Database

db1.RegisterForDataCompare(New ConnectionProperties(sServer, sDatabase))
db2.RegisterForDataCompare(New ConnectionProperties(tServer, tdatabase))
......

Comments

  • You'll need an extra Import...
    Imports RedGate.SQLCompare.BackupReader
    

    You'll also need to make sure you have the following files with your program...
    RedGate.BackupReader.dll
    RedGate.BackupReader.SqbReader.dll
    RedGate.SQLCompare.BackupReader.dll
    System.Data.SQLite.dll
    rglz.dll
    zlib1.dll
    

    And the code is simply...
    Dim db1 as New BackupDatabase
    db1.RegisterForDataCompare(New String() {"c:\\widgetdev.sqb"}, New String() {"password"}, Nothing)
    

    The third argument is a backupset which is irrelevant for sqb files, the string arrays are used so you can pass multiple files. For each file you can set the password. If you don't have passwords you can simply omit this argument e.g....
    Dim db1 as New BackupDatabase
    db1.RegisterForDataCompare(New String() {"c:\\widgetdev.sqb"}, Nothing)
    

    HTH
    Richard Mitchell
    Project Manager
    Red Gate Software Ltd
Sign In or Register to comment.