Click here to Skip to main content
15,885,842 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two database having identical schema and same table in both database. I want to iterate both database and want to compare each table in both database.

My problem: How to iterate both database and where to put if condition to check whether it is same table from both database or not.

What I have tried:

suppose there are test and live two database. In both tables there are three tables student, course, enrollment.

I want to put condition like :
If(table1==table2)
{
//code for comparison of tables.
}
where table1 is coming from test database and table2 is coming from live database.

I need some idea how to iterate both database to get name of table.
Posted
Updated 2-Oct-22 15:56pm
Comments
Richard Deeming 20-Dec-17 12:32pm    
ZurdoDev 20-Dec-17 12:45pm    
Buy one of the already built tools to do this.
Member 13548480 21-Dec-17 0:08am    
I am developing such tools for school project.
RDBurmon 21-Dec-17 1:45am    
what do you want to compare? just a table name or data inside that table
Member 13548480 21-Dec-17 3:58am    
First table name then data inside both table having same name.

1 solution

You can try DataTable.AsEnumerable().Except()
See example here: DataTable Comparison Using LINQ Except, Intersect and Union : www.dotnetmentors.com[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900