Compare Snapshot to Database

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Compare Snapshot to Database

Postby wkhazzard » Tue Mar 15, 2011 7:17 pm

I am trying to compare a snapshot to a database using the SQL Compare SDK. I have looked at all the samples and combed through the object model. I can't figure out how to get a SnapshotSource object to behave as a Database object or vice versa. Nor can I find a CompareWith method on the database class that accepts a SnapshotSource or an IDataSource. Is there a sample floating about at Red Gate that shows how to compare a snapshot with a database in the same way that the stand-alone SQL Compare tool does this?

Thanks,
Kevin Hazzard, C# MVP & Friend of Red Gate
http://devjourney.com
wkhazzard
 
Posts: 12
Joined: Tue Mar 08, 2011 4:28 pm
Location: Mid-Atlantic USA

Postby james.billings » Wed Mar 16, 2011 8:52 pm

Thanks for your post. I think the snapshotsource is more for creating the snapshots.

If you set it up to work with two Database objects, you should be able to use the "LoadFromDisk" method on one of them to load a snapshot file, i.e:

Code: Select all
Database productionDB = new Database();
productionDB.LoadFromDisk(@"c:\\snapshots\\MySnapshot.snp");
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby wkhazzard » Fri Mar 18, 2011 3:56 pm

Thanks, James. Worked like a charm. The LoadFromDisk method name just didn't jump out as the correct way to load a snapshot.

Cheers,
Kevin Hazzard, C# MVP & Friend of Red Gate
http://devjourney.com
wkhazzard
 
Posts: 12
Joined: Tue Mar 08, 2011 4:28 pm
Location: Mid-Atlantic USA

Postby james.billings » Wed Mar 23, 2011 9:11 pm

No, it took me a little while to find that one too! Glad it's working.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests