如何使它们在同一数据表之间的关系? [英] How to make relation between tables which are in same dataset?
本文介绍了如何使它们在同一数据表之间的关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据集,其中有
40桌。现在,我想使这些表显示
重要的数据网格之间的关系
。我该怎么做呢?
块引用>
解决方案如果您正在创建一个类型化的DataSet,最简单的方法建立在Visual Studio中的数据集设计之间的关系。在设计表只需单击鼠标右键,选择添加 - >关系,并指定关系。
如果您需要在代码中指定的关系,你可以做它是这样的:
dataSet.Relations.Add(dataSet.Tables [客户]列[客户ID],
dataSet.Tables [订单]列[客户ID]);
阅读所有关于它在MSDN中的这里。
I have one dataset in which there are 40 tables. Now i want to make a relation between these tables and show important data in grid. How do i do this?
解决方案If you're creating a typed dataset, it's easiest to create the relations in Visual Studio's dataset designer. Just right-click on the table in the designer, select Add->Relation, and specify the relation.
If you need to specify the relation in code, you can do it like this:
dataSet.Relations.Add(dataSet.Tables["Customers"].Columns["customerId"], dataSet.Tables["Orders"].Columns["customerId"]);
Read all about it in MSDN here.
这篇关于如何使它们在同一数据表之间的关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文