title: Listview- User Comments
body: <p>I am developing a functionality in my web app. Its a cooking community.The functionality is online discussion. The users can comment underneath a recipe. I used a listview control. I am able to retrieve the user name, using a nested query. Only one dataset object can be assigned to the DataSource property of the ListView control. I need both Username and Comment Value. The username is being diplayed. I am having problem with displaying the comment of that particular user.  but I need to display the comments of the users too. How do I achieve 
   code behind to display comments:</p>
  
  <pre><code> public void dispComments()
      {
          MySqlConnection con = new MySqlConnection("Server=localhost;Database=FreedomKitchen;Uid=root;Password=;");
          con.Open();
  
          MySqlCommand cmd = new MySqlCommand("select Username from User_Details where User_ID in(select User_ID from Recipe_Comments)", con);
          MySqlDataAdapter da = new MySqlDataAdapter();
          da.SelectCommand = cmd;
          DataSet ds = new DataSet();
          da.Fill(ds, "User_Comments");
          ListView1.DataSource = ds;
          ListView1.DataBind();
          con.Close();
      } 
  </code></pre>
  
  <p>List View Source Code: 
   </p>
  
  <pre><code>             &lt;ItemTemplate&gt;
  
                   &lt;div id="div123"&gt;
              &lt;asp:Label ID="User" 
                 runat="Server" 
                 Text='&lt;%#Eval("Username") %&gt;'
          width="850"
          height="80"
           /&gt;
    &lt;%--  &lt;asp:Label ID="Comment" 
                 runat="Server" 
                 Text='&lt;%#Eval("Comment") %&gt;'
          width="850"
          height="80"
           /&gt;--%&gt;
                   &lt;/div&gt;
  
  &lt;/ItemTemplate&gt;
              &lt;ItemSeparatorTemplate&gt;
  
                  &lt;br /&gt;
              &lt;/ItemSeparatorTemplate&gt;
  
          &lt;/asp:ListView&gt;
  </code></pre>
  
  <p>Database: 
  User_Details table</p>
  
  <p>User_ID  //need to display this in a listview item
  First_Name<br>
  Last_Name<br>
  Age<br>
  Gender<br>
  Country<br>
  About_User<br>
  Username<br>
  Password  </p>
  
  <p>User_Comments table</p>
  
  <p>Recipe_ID<br>
  User_ID<br>
  Comment   //need to display this  a listview item</p>