title: Adding row in asp.net table
body: <p>I have the following code in my .aspx file</p>
  
  <pre><code>&lt;asp:Table ID="tabStudent" runat="server"&gt;&lt;/asp:Table&gt;
  </code></pre>
  
  <p>I declared all variables which I used below. I wrote the following code snippet in the page <code>load</code> event. But it only shows only one row which having last row in my database. But when I am using message box inside this <code>while</code> loop to <code>print</code> those values I am getting all the rows.</p>
  
  <pre><code>Reader = Command.ExecuteReader()
  While Reader.Read()
      lblRollNo.Text = Reader.Item(0)
      lblName.Text = Reader.Item(1)
      lblDob.Text = Reader.Item(2)
      tcRollNo.Controls.Add(lblRollNo)
      tcName.Controls.Add(lblName)
      tcDob.Controls.Add(lblDob)
      TableRow.Cells.Add(tcRollNo)
      TableRow.Cells.Add(tcName)
      TableRow.Cells.Add(tcDob)
      tabStudent.Rows.Add(TableRow)
  End While
  </code></pre>
  
  <p>what is wrong with this code?</p>