Merge Method (otherDatabase, errorTable)

Microsoft Deployment Tools

Deployment Tools Foundation Merge Method (otherDatabase, errorTable)
Deployment Tools Foundation NamespacesMicrosoft.Deployment.WindowsInstallerDatabaseMerge(Database, String)
Merges another database with this database.
Declaration Syntax
C# Visual Basic Visual C++
public void Merge(
	Database otherDatabase,
	string errorTable
)
Public Sub Merge ( _
	otherDatabase As Database, _
	errorTable As String _
)
public:
void Merge(
	Database^ otherDatabase, 
	String^ errorTable
)
Parameters
otherDatabase (Database)
The database to be merged into this database
errorTable (String)
Optional name of table to contain the names of the tables containing merge conflicts, the number of conflicting rows within the table, and a reference to the table with the merge conflict.
Remarks

Merge does not copy over embedded cabinet files or embedded transforms from the reference database into the target database. Embedded data streams that are listed in the Binary table or Icon table are copied from the reference database to the target database. Storage embedded in the reference database are not copied to the target database.

The Merge method merges the data of two databases. These databases must have the same codepage. The merge fails if any tables or rows in the databases conflict. A conflict exists if the data in any row in the first database differs from the data in the corresponding row of the second database. Corresponding rows are in the same table of both databases and have the same primary key in both databases. The tables of non-conflicting databases must have the same number of primary keys, same number of columns, same column types, same column names, and the same data in rows with identical primary keys. Temporary columns however don't matter in the column count and corresponding tables can have a different number of temporary columns without creating conflict as long as the persistent columns match.

If the number, type, or name of columns in corresponding tables are different, the schema of the two databases are incompatible and the installer will stop processing tables and the merge fails. The installer checks that the two databases have the same schema before checking for row merge conflicts. If the schemas are incompatible, the databases have be modified.

If the data in particular rows differ, this is a row merge conflict, the merge fails and creates a new table with the specified name. The first column of this table is the name of the table having the conflict. The second column gives the number of rows in the table having the conflict.

Win32 MSI API: MsiDatabaseMerge

Exceptions
Exception Condition
MergeException merge failed due to a schema difference or data conflict
InvalidHandleException the Database handle is invalid

Assembly: Microsoft.Deployment.WindowsInstaller (Module: Microsoft.Deployment.WindowsInstaller) Version: 3.0.0.0 (3.5.1623.0)