I am trying to do a data compare between two sql server backups. the TableDifferences collection is always empty. I know there are differences because I added six records myself and had our DBA check both backups using his RedGate client. Could you please look over this code and see if I made any mistakes.

By the way I think this issue is related to a previous post I entered about not being able to read data from a backup. I have tried everything I can think of and finally gave up. James it sounds like you have the ability to read from a backup could you post a small code sample.

Thank you for your reply. Per your advice, I attempted the same comparison using SQL Data Compare 10.4. This worked correctly for both emulating WidgetDev->WidgetLive comparison, as well as my own situation.

Here are the steps to reproduce the failure in the example included in SQL Comparison SDK 1.5:

1. Install SQL Comparison SDK 10 (10.5.0.7)
2. Open "C:\\Program Files (x86)\\Red Gate\\SQL Comparison SDK 10\\GettingStarted.exe" and click "SQL creation script for sample databases"
3. Logged in under an administrative account, run the supplied script on SQL Server (for reference, I have tried this on SQL Server 2008 (10.0.2531) and SSDT's LocalDB (11.0.3000))
4. Open the C# SQL Data Compare API samples folder from the GettingStarted.exe
5. Open Visual Studio 2008 as an Administrator (so it has write access to the installation folder)
6. Open "SQLDataCompareCodeSnippets.csproj" in the newly opened Visual Studio instance.
7. Edit Program.cs, changing the DevServerName and LiveServerName to the server from step 3.
8. Run the example program.
9. Run option c) Backup Comparison.

Here is where the first problem occurs. A DllNotFound exception is thrown on line 37 of BackupComparisonExample.cs:

I'm going to escalate this to our developers to see if they can work out the cause.
I have tested with a set of script folders too and these seem to work OK, so you might want to try that as an alternative.

You'd basically change the registration from the Backup code to:

using (Database backupDB= new Database())backupDB.RegisterForDataCompare("d:\\\\WidgetTest", new RedGate.SQLCompare.Engine.ReadFromFolder.ScriptDatabaseInformation(), Options.Default);

The rest is pretty much the same. You can create scripts of the schema using SQL Compare (and the SDK has a snippet example I think), and SQL Data Compare will sync from the DB > Script folder to populate it. That folder can then be deployed with an SDK app instead of a backup.

Nothing concrete- my guess is that it's indeed a bug. I'll get one logged in our Jira system for it. Unfortunately the Compare team are currently working flat out on SQL 2014 support and I'm not sure when they are next checking into the SDK, so I can't give an eta on when this is likely to get looked at I'm afraid.