开发者

How to retrieve from two tables with same foreign key repeated more than once?

How to display the data of tables that are linked by a primary key and foreign key where the foreign key of the data repeats?

For ex. I have two tables, ParentTable开发者_如何学Python and Childtable.

The primary key of ParentTable acts as the foreign key of ChildTable.

There are more than one record with same ParentId in ChildTable. How to retrieve them and display in a single Grid or List or any type of view?


As for the query: if you are using Oracle you may use a CONNECT BY statement in your query; otherwise you can just use a JOIN on the foreign key to retrieve the list of couples Parent-Child and handle them in your C# business logic.

As for the presentation: this is the classic tree structure, so you may find a Treeview useful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜