SqlProvider -> GetMigrationSQL throw NullReferenceException

Automate and integrate using the SQL comparison API

Moderators: Chris Auckland, David Atkinson, Michelle Taylor, chengvoon.tong

SqlProvider -> GetMigrationSQL throw NullReferenceException

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

Hi,

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
Try
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?

Thanks,


Susan
ThomasDev
 
Posts: 1
Joined: Tue Jul 17, 2012 5:30 pm

Postby Brian Donahue » Wed Jul 18, 2012 1: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:
http://sdk.red-gate.com/index.php/SQLProviderExample
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK 10

Who is online

Users browsing this forum: No registered users and 0 guests