SqlProvider -> GetMigrationSQL throw NullReferenceException
ThomasDev
Posts: 2
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
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
Comments
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