Compare specific tables
beorn107
Posts: 4
Can anyone provide some example code (vb.net preferred) or point me to some existing code that shows how to use the toolkit to compare a select list of tables.
For example I have a pubs db on 2 servers and I want to compare just the authors, sales and stores tables. I do not want to do a complete compare of the databases.
Thanks in advance.
For example I have a pubs db on 2 servers and I want to compare just the authors, sales and stores tables. I do not want to do a complete compare of the databases.
Thanks in advance.
Comments
Do you want to comapre schema or data? For schema, it's a matter of changing the .Selected property in the loop that runs through the differences collection. For Data Compare, it's a bit different.
Dim db1 As Database = New Database
Dim db2 As Database = New Database
db1.Register(New ConnectionProperties("server1", "pubs"), Options.Default)
db2.Register(New ConnectionProperties("server2", "pubs"), Options.Default)
Dim differences As Differences = db1.CompareWith(db2, Options.Default)
Dim difference As Difference
For Each difference In differences
Console.WriteLine("{0} {1} {2}", difference.Type.ToString(), difference.DatabaseObjectType.ToString(), difference.Name)
difference.Selected = True
Next
'dispose
db1.Dispose()
db2.Dispose()
But, say you have a hashtable with a list of tables that you want to compare: