title: Show data in ASP.NET html table
body: <p>I am writing an ASP.NET page which reads data from a database and needs to show it in a table. For some reason, I don't want to use the gridView. </p>
  
  <p><strong>How do I show the data in a table on the HTML page?</strong></p>
  
  <p>This is my C# code:</p>
  
  <pre><code>        SqlConnection thisConnection = new SqlConnection(dbConnection);
          SqlCommand thisCommand = thisConnection.CreateCommand();
          thisCommand.CommandText = "SELECT * from Test";
          thisConnection.Open();
          SqlDataReader reader = thisCommand.ExecuteReader();
  
          while (reader.Read())
          {
              int id = reader.GetInt32(0);
              string Name = reader.GetString(1);
              string Pass = reader.GetString(2);                   
          }
  
          thisConnection.Close();
  </code></pre>
  
  <p>This is my ASPX page:</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/test.master" CodeFile="test.aspx.cs" Inherits="test" %&gt;
  
  &lt;asp:Content ID="BodyContent" runat="server"  ContentPlaceHolderID="ContentPlaceHolder"&gt;
      &lt;table width="100%" align="center" cellpadding="2" cellspacing="2" border="0" bgcolor="#EAEAEA" &gt;
          &lt;tr align="left" style="background-color:#004080;color:White;" &gt;
              &lt;td&gt; ID &lt;/td&gt;                        
              &lt;td&gt; Name &lt;/td&gt;            
              &lt;td&gt;Pass&lt;/td&gt;                        
          &lt;/tr&gt;
  
          **&lt;%--Need the while output into here--%&gt;**
  
      &lt;/table&gt;
  &lt;/asp:Content&gt;
  </code></pre>