i have 2 table, Topic and Comment..
TOPIC
IdTopic
TopicName
CreatedOn
CreatedBy
COMMENT
IdComment
IdTopic(FK)
Comment
ReplayOn
ReplayBy
I want to count all comment where Comment.IdTopic == Topic.IdTopic
cant u help me?
i'm using Linq to sql and C#
thx,

Suthish NairRank #92 · 22.8K reputationPosted Feb 4, 2011, 11:16 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Feb 4, 2011, 1:38 PM EST
kieky bouvier57 reputationPosted Feb 5, 2011, 7:40 AM EST
thx suthish for your link..
yeah, finally i've got the answer..
protected String GetCountComment(string IdTopic)
{
string value = String.Empty;
DMSDataAccess db = new DMSDataAccess();
var comment = db.DMSDataContext.Comments.Where(p => Convert.ToString(p.IdTopic) == IdTopic);
value = Convert.ToString(comment.Count());
return value;
}
Suthish NairRank #92 · 22.8K reputationPosted Feb 5, 2011, 7:45 AM EST