How can we help you today? How can we help you today?
jbravoh
Thanks, Brian. I´m testing but dont works. I have two tables with same structure but the first have two rows and second, three: script don´t make nothing. My code is this: Dim db1 As New Database Dim db2 As New Database db1.RegisterForDataCompare(New ConnectionProperties(MyServer1, MyDB1, myAccount1, myPass1), Options.Default) db2.RegisterForDataCompare(New ConnectionProperties(MyServer2, MyDB2, myAccount2, myPass2), Options.Default) Dim mappings As New TableMappings Dim tableMapping As TableMapping = CType(mappings.Join(db1.Tables("[dbo].[foo]"), db2.Tables("[dbo].[bar]")), TableMapping) tableMapping.FieldMappings.Add(New FieldMapping(tableMapping.Obj1.Fields("WidgetID"), tableMapping.Obj2.Fields("WidgetID"), FieldMappingStatus.Success)) tableMapping.RefreshMappingStatus() mappings.Add(tableMapping) Dim session As New ComparisonSession session.CompareDatabases(db1, db2, mappings) Dim provider As New SqlProvider Dim block As ExecutionBlock Try block = provider.GetMigrationSQL(session, True) Dim executor As RedGate.SQL.Shared.BlockExecutor = New BlockExecutor executor.ExecuteBlock(block, MyServer2, MyDB2, False, myAccount2, myPass2) Catch ex As SystemException Dim err As String err = "Error: " & ex.Message Finally block = provider.Block If (TypeOf block Is ExecutionBlock) Then block.Dispose() End If End Try session.Dispose() db1.Dispose() db2.Dispose() / comments
Thanks, Brian. I´m testing but dont works. I have two tables with same structure but the first have two rows and second, three: script don´t make nothing. My code is this: Dim db1 As New Database D...
0 votes
It´s clear, Brian. But don´t works. My code is like: Dim db1 As New Database Dim db2 As New Database db1.RegisterForDataCompare(New ConnectionProperties(MyServer1, MyDB1, myAccount1, myPass1), Options.Default) db2.RegisterForDataCompare(New ConnectionProperties(MyServer2, MyDB2, myAccount2, myPass2), Options.Default) Dim mappings As New TableMappings Dim tableMapping As TableMapping = CType(mappings.Join(db1.Tables("[dbo].[myTable1]"), db2.Tables("[dbo].[myTable2]")), TableMapping) tableMapping.FieldMappings.Add(New FieldMapping(tableMapping.Obj1.Fields("myField1"), tableMapping.Obj2.Fields("myField2"), FieldMappingStatus.Success)) tableMapping.RefreshMappingStatus() mappings.Add(tableMapping) Dim session As New ComparisonSession session.CompareDatabases(db1, db2, mappings) Dim provider As New SqlProvider Dim block As ExecutionBlock Try block = provider.GetMigrationSQL(session, True) Dim executor As RedGate.SQL.Shared.BlockExecutor = New BlockExecutor executor.ExecuteBlock(block, MyServer2, MyDB2, False, myAccount2, myPass2) Catch ex As SystemException Dim err As String err = "Error: " & ex.Message Finally block = provider.Block If (TypeOf block Is ExecutionBlock) Then block.Dispose() End If End Try session.Dispose() db1.Dispose() db2.Dispose() This is your code translated to VB.NET and don´t works to me. Regards, Jorge / comments
It´s clear, Brian. But don´t works. My code is like: Dim db1 As New Database Dim db2 As New Database db1.RegisterForDataCompare(New ConnectionProperties(MyServer1, MyDB1, myAccount1, myPass1), Opt...
0 votes