Red Gate forums :: View topic - RedGate.SQLCompare.Engine.Differences Issue
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK 10
SQL Comparison SDK 10 forum

RedGate.SQLCompare.Engine.Differences Issue

Search in SQL Comparison SDK 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
rscornette



Joined: 12 Jul 2012
Posts: 2

PostPosted: Thu Jul 12, 2012 6:18 pm    Post subject: RedGate.SQLCompare.Engine.Differences Issue Reply with quote

I am attempting to compare two databases utilizing code samples found on the RedGate site; however, I am getting an "Object reference not set to an instance of an object" error in the following line: Differences dbSourceVsdbTarget = dbSource.CompareWith(dbTarget, Options.Default);

The full code snippet is as follows:

using (Database dbSource = new Database(),
dbTarget = new Database())
{
// Retrieve the schema information for the two databases
Console.WriteLine("Registering databases");
dbSource.Register(new ConnectionProperties("vbserve20.libtax.com", "Franchise"), Options.Default);
dbSource.Register(new ConnectionProperties("vbserve18.libtax.com", "Franchise"), Options.Default);

Console.WriteLine("Comparing Databases");
Differences dbSourceVsdbTarget = dbSource.CompareWith(dbTarget, Options.Default);

// Set the filespec for our HTML report
string ReportOutput = @"C:\Users\scott.cornette\Desktop\htmlreport.html";
// Set the XSL template to use for the report. These ship with the SQL Compare software
string xsltemplate = @"C:\Program Files (x86)\Red Gate\SQL Compare 9\SQLCompareInteractiveReportTemplate.xsl";

Console.WriteLine("Creating report...");
HTMLReport.CreateHtmlReport(ReportOutput, dbSource, dbTarget, dbSourceVsdbTarget, Options.Default, xsltemplate);

Console.WriteLine("Finished creating {0}, viewing", ReportOutput);
HTMLReport.ViewReport(ReportOutput);
}

Any help would be greatly appreciated. There does not appear to be a constructor available for the Differences collection, so I am not sure what to do.
Back to top
View user's profile Send private message
rscornette



Joined: 12 Jul 2012
Posts: 2

PostPosted: Thu Jul 12, 2012 6:33 pm    Post subject: RedGate.SQLCompare.Engine.Differences Issue Reply with quote

All,

I realized the error of my ways: I inadvertently failed to register the dbTarget object because in my cut-n-paste efforts, I used dbSource twice.

Sorry - problem resolved.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group