SqlProvider -> GetMigrationSQL throw NullReferenceException

Automate and integrate using the SQL comparison API

SqlProvider -> GetMigrationSQL throw NullReferenceException

Postby ThomasDev » Tue Jul 17, 2012 4:42 pm


I am new with SQL DATA Compare SDK 10. I am currently experencing this null exception during the call to SqlProvider/GetMigrationSQL. Here's the code excerpt,

Dim provider As SqlProvider
Dim block As ExecutionBlock
Dim str As String
provider = New SqlProvider()
'run the SQL on destination DB server
block = provider.GetMigrationSQL(session, True)
Catch ex As Exception
str = ex.ToString
End Try

The details of exception looks like that,

System.NullReferenceException: Object reference not set to an instance of an object. at #8ZK.#j2K.#kOW(#x1K #Zds, ComparisonSession #RlYb, Boolean #hkl) at RedGate.SQLDataCompare.Engine.SqlProvider.#CbL(ComparisonSession #RlYb, Boolean #hkl) at RedGate.SQLDataCompare.Engine.SqlProvider.#DbL(ComparisonSession #RlYb, SelectionDelegate #UKPb, Boolean #hkl) at RedGate.SQLDataCompare.Engine.SqlProvider.GetMigrationSQL(ComparisonSession session, SelectionDelegate select, Boolean runOnTwo) at Thomas.MultiLang.DBSynchronizer.SyncDBData() in C:\\Projects\\Thomas\\Flex\\Thomas.Server\\Thomas.MultiLang\\Manager\\DBSynchronizer.vb:line 165"

Throught my online search, I got some sense that about two database tables schema may be different. So i used Redgate Sql compare Tool to compare the two DB and the result was that the two DB were identical.

Could you tell me where went wrong?


Posts: 1
Joined: Tue Jul 17, 2012 4:30 pm

Postby Brian Donahue » Wed Jul 18, 2012 12:40 pm

Hi Susan,

It looks like you have to build a list of differences (using the CompareDatabases method) before you can use this method. Please see:
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests