Here's an example of what Kristen is talking aboutDECLARE @idTable TABLE (ID int)INSERT INTO @idTableSELECT ArticleIDFROM ArticlesWHERE <whatever criteria you have>-- recordset 1 (dataSet.Tables[0]) lists all the articlesSELECT a.ArticleID, a.Headline, a.BodyFROM @idTable t INNER JOIN Articles a ON t.ID = a.ArticleID-- recordset 2 (dataSet.Tables[1]) lists all the comments for the above articlesSELECT c.ArticleID, c.CommentID, c.CommentTextFROM @idTable t INNER JOIN Comments c ON t.ID = c.ArticleID
in your .net code, use a dataview on the 2nd recordset (dataSet.Tables[1]) where you set the .RowFilter property for each article IDDataView dv = new DataView(dataSet.Tables[1]);foreach(DataRow row in dataSet.Tables[0].Rows){ article = new Article(); article.ArticleID = (int)row["ArticleID"]; article.Headline = (string)row["Headline"]; article.Body = (string)row["Body"]; dv.RowFilter = string.Format("ArticleID = {0}", article.ArticleID); foreach(DataRowView comment in dv) article.Comments.Add(new Comment((int)comment["CommentID"], (string)comment["CommentText"])); listOfArticles.Add(article);}/jeff