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 NairPosted Feb 5, 2011, 12:45 PM
kieky bouvierPosted Feb 5, 2011, 12:40 PM
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;
}
Sam HobbsPosted Feb 4, 2011, 6:38 PM
Suthish NairPosted Feb 4, 2011, 4:16 PM