Confused by Database Source and Target
diesel7633
Posts: 5 New member
I'm having trouble understanding which is the source and which is the target in the SQL Data Compare SDK.
I'm loading a project from disk. When I open the project I can see the source (DatabaseA) and target (DatabaseB) database names.
In code I'm doing...
So essentially this is what I wanted...I want the changes to take effect on DatabaseB. When I run the statements below and view the scripts that are produced...the databases are switched in the generated SQL header.
This is the SQL Header and the scripts seem reversed:
Any thoughts?
I'm loading a project from disk. When I open the project I can see the source (DatabaseA) and target (DatabaseB) database names.
In code I'm doing...
Project project = Project.LoadFromDisk(@"myproject.sdc"); using (Database fromDatabase=new Database()) using (Database toDatabase=new Database()) { //debugging shows this is DatabaseA LiveDatabaseSource fromLiveDataSource = project.DataSource1 as LiveDatabaseSource; ConnectionProperties fromConnectionProperties = fromLiveDataSource.ToConnectionProperties(); //debugging shows this is DatabaseB LiveDatabaseSource toLiveDataSource = project.DataSource2 as LiveDatabaseSource; ConnectionProperties toConnectionProperties = toLiveDataSource.ToConnectionProperties(); //excluded exception handling for clarify in forum post fromDatabase.RegisterForDataCompare(fromConnectionProperties, Options.Default); toDatabase.RegisterForDataCompare(toConnectionProperties, Options.Default);
So essentially this is what I wanted...I want the changes to take effect on DatabaseB. When I run the statements below and view the scripts that are produced...the databases are switched in the generated SQL header.
RedGate.SQLDataCompare.Engine.DataCompareUserActions.ReplayUserActions( project.SelectTableActions, project.DataSource1, project.DataSource2, ref mappings); using(ComparisonSession session = new ComparisonSession()) { session.CompareDatabases(fromDatabase, toDatabase, mappings); } }
This is the SQL Header and the scripts seem reversed:
/* Run this script on: DatabaseA - This database will be modified to synchronize it with: DatabaseB You are recommended to back up your database before running this script Script created by SQL Data Compare version 8.1.0 from Red Gate Software Ltd at 06/29/2010 10:37:53 */
Any thoughts?
Comments