使用C#和Ado.net比较数据库(仅表) [英] compare databases (tables only) using C# and Ado.net

查看:134
本文介绍了使用C#和Ado.net比较数据库(仅表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个以两个数据库作为输入的软件,比较表格和表格之间的差异。

I am trying to develop a software that takes two databases as its input, compares there tables and show differences between tables.

这是我想和开发的。

1)选择机器上安装的所有服务器。
2)根据所选服务器,列出所有安装的数据库。
3)根据数据库,此方法返回数据库中的所有表名。
4)现在我有两个数据库和数据库中所有表的名称的信息。我正在将这两个数据库填充到两个DataSet对象(源,目标)中。
5)现在,我正在迭代DataSet,比较每个表(对应于索引)。并保存两个数据表不一致的索引记录。

1) Select all the servers that are installed on machine. 2) Depending on the selected server it list all the databases installed. 3) Depending upon the Databases, this method returns all the tables names in the database. 4) Now I have info about two databases and name of all the tables in both the databases. I am filling both the databases into two DataSet objects (source, destination). 5) Now, I am iterating both DataSet, comparing each tables (corresponding to index). And keeping record of the index on which two datatables are not same.

我的问题是 -
1)以两个数据库为输入。
2)显示GUI中的差异(在表数据上)。并更新源数据库和/或目标数据库。

My problem is- 1) take two databases as its input. 2) show the differences (on table data) in GUI. And update both source and/or destination databases.

区别:
显示/突出显示源数据库中不存在的所有表记录,而不在目标数据库中,用户必须有能力单独选择这些记录,然后应用程序应该将这些记录插入到destinationDB中。

Difference: Show/Highlight all the table records that are present in sourceDB but not in destinationDB and user must have ability to select these records individually then application should insert these records into destinationDB.

显示/突出显示destinationDb中的所有表记录,但不显示在sourceDb中,用户必须有能力单独选择这些记录并将其从目的地删除。

Show/highlight all the table records that are present in destinationDb but not in sourceDb and user must have ability to select these records individually and delete them from destination.

我可以使用Entity Framework做同样的事情吗?

Can I do the same thing using Entity Framework?

推荐答案

正确使用实体框架是工作在一个已知的模型,在你的情况下你不是。

ADO.Net是正确的选择。

"Right" use of entity framework is to work on a known model and in your case you are not.
ADO.Net is the right choice.

这篇关于使用C#和Ado.net比较数据库(仅表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆