开发者

ADO.NET DataRelations and many-to-many relationship

I was really drawn in and fascinated by the DataRelation object for use in an ADO.NET DataSet to cache data from my database in an ASP.NET web application. Unfortunately, I realized quite late, that I really have three DataTables.

  • Users with a PK of UserID
  • Groups with a PK of GroupID
  • UsersInGroups a linking table with UserID and GroupID columns

Is it possible to load these three tables into a DataSet, add DataRelations, and then retrieve:

  • All Groups
  • All Users
  • All Groups that contain a certain user (by Use开发者_JAVA技巧rID)
  • All Users in a specific group (by GroupID)


Here is a good reference from MS

http://msdn.microsoft.com/en-us/library/d6s958d6(VS.71).aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜