Compare SQL Native Backup to LiveDatabase

Forum for users of SQL Toolkit 3,4,and 5

Compare SQL Native Backup to LiveDatabase

Postby rockywurden » Mon Dec 10, 2007 11:16 pm

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))
......
rockywurden
 
Posts: 6
Joined: Mon Dec 10, 2007 11:01 pm

Postby richardjm » Wed Dec 12, 2007 10:02 am

You'll need an extra Import...

Code: Select all
Imports RedGate.SQLCompare.BackupReader


You'll also need to make sure you have the following files with your program...

Code: Select all
RedGate.BackupReader.dll
RedGate.BackupReader.SqbReader.dll
RedGate.SQLCompare.BackupReader.dll
System.Data.SQLite.dll
rglz.dll
zlib1.dll


And the code is simply...

Code: Select all
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....

Code: Select all
Dim db1 as New BackupDatabase
db1.RegisterForDataCompare(New String() {"c:\\\\widgetdev.sqb"}, Nothing)


HTH
Richard Mitchell
Project Manager
Red Gate Software Ltd
richardjm
 
Posts: 395
Joined: Fri May 20, 2005 9:44 am
Location: Red Gate Software Ltd


Return to SQL Toolkit Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests