知道在数据源中使用关系数据库中的哪个表 [英] Know which table in relationship database to use in data source

查看:58
本文介绍了知道在数据源中使用关系数据库中的哪个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好 -



我有一个非常简单的问题,但对我来说很难理解。我试图用C#(Winforms)创建一个数据库应用程序。我在Visual Studio中有一个数据库。在DataSet中我创建了关系。现在,在我扩展表格的数据源中,我看到其中的另一个表格,我也可以扩展该表格。



我遇到的困惑 - 所有4表以某种方式连接,当您展开表时,有一个表驻留在该表中,但嵌套表也驻留在其他表中。当我将列拖到表单上时,如何知道要使用哪个表格?



任何人都可以指出我可以在哪里准确了解表格的分配方式数据源以及创建关系时 - 您如何知道在表单上使用哪个表?



我希望这是有道理的。



更新问题:



Hi All -

I have a very simple question, but hard to understand for me. I am trying to create a database application in C# (Winforms).I have a database in Visual Studio. In the DataSet I created relationships. Now, in my Data Source when I expand a table I see another table inside it, and I can expand that table too.

The confusion I am having - All 4 tables are connected in one way or another and when you expand a table there is a table that resides in that table, however, the nested table also resides in other table. How do I know which table to use when I drag the column onto the form?

Can anyone point me to where I can learn exactly how the tables are assigned in the Data Source and when the relationship is created - how do you know which table to use on the forms?

I hope this makes sense.

Update to question:

Thanks for the replies. Yes, the relationships are very obvious to me since I created them. However, not sure if I am doing it the best way, but after I create the relationships - I always drag the fields from the Data Source Window over to the form, and that creates the Binding Source and Navigator.

Before I create the relationships:

tblClient
ClientID
FirstName
LastName

tblFile
FileID
ClientID
FileNumber
FileDate

tblReceipts
ReceiptID
FileID
ReceiptNumber
ReceiptDate

tblCoSigner
CoSignerID
ReceiptID
CoFirstName
CoLastName

Then my relationships look like this:

tblClient - tblFile (1 to many)
tblFile - tblReceipts (1 to many)
tblReceipts - tblCoSigner (1 to many)

After the relationships the Data Source Window now has:

Client Table
ClientID
FirstName
LastName
-tblFile
FileID
CleintID
FileNumber
Date
-tblReceipts
ReceiptID
FileID
ReceiptNumber
-tblCosigner
CosignerID
ReceiptID
CoFirstName
CoLastName

tblFile
FileID
ClientID
FileNumber
Date
-tblReceipts
ReceiptID
FileID
ReceiptNumber
-tblCoSigner
CosignerID
ReceiptID
CoFirstName
CoLastName

So with the above, you see how tblCoSigner was placed in two different tables, as well as, outside of the table. Also, the other tables are placed inside other tables that there is a relationship with. When I drag a column over to the form to create the binded text box, how do I know for sure which ones are going to use the relationship when they are a child of several other parent tables.

Hope this make sense in trying to make this easier for you.





我尝试了什么:



谷歌并试图弄清楚自己。



What I have tried:

google and trying to figure it out myself.

推荐答案

我想出了我的问题。首先,我必须找到顶级表,然后在数据源中所有表都在彼此之内,如果你挖得足够远。由于我没有看到顶层 - 我没有看到所有关系在哪里。



这可以关闭。
I figured out the question I had. First, I had to find the top level table and then in the data source all the tables are within each other, if you dig down far enough. Since I wasn't looking at the top level - I didn't see where all the relationships were held together.

This can be closed.


请将您的答案标记为正确的答案。
Please mark your answer as the right answer.


这篇关于知道在数据源中使用关系数据库中的哪个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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