saquib189: so i want to INNER JOIN the tables that shows comment as per article
But your select query will show the comments for all articles,
You must have a 1-M relation between the article and the comments table , because every article will have many comments ,
so you must have the articleID as a foreign key in the comments table , then you can use this query
SELECT dbo.aspnet_Users.UserName, GameComment.Subject, GameComment.Body, GameComment.CommentDate From GameComment INNER JOIN dbo.aspnet_Users ON GameComment.UserId = dbo.aspnet_Users.UserId where ArticleId=@ArticleId
Also you need to pass the current articleId or the ArticleID parameter , if you used the query string to pass the articleID , then you can use the Query string parameter ,
<asp:SqlDataSource ID="Games" runat="server" ConnectionString="<%$ ConnectionStrings:SecurityTutorialsConnectionString %>"
SelectCommand="SELECT dbo.aspnet_Users.UserName, GameComment.Subject, GameComment.Body, GameComment.CommentDate From GameComment INNER JOIN dbo.aspnet_Users ON GameComment.UserId = dbo.aspnet_Users.UserId where ArticleId=@ArticleId ">
<SelectParameters>
<asp:QueryStringParameter QueryStringField="ArticleId" Name="ArticleId" Type="int32" />
</SelectParameters>
</asp:SqlDataSource>