I have this HTML table:
<table ID="tbl_ClientSearch" style="width: 83%;" runat="server">
<thead>
<tr>
<td>Client Account Number</td>
<td>Client Name</td>
</tr>
</thead>
<tbody>
<tr>
<td><asp:Literal ID="CliNox" runat="server"></asp:Literal></td>
<td><asp:Literal ID="CliNamex" runat="server"></asp:Literal></td>
</tr>
</tbody>
</table>
Then I have this query:
SqlCommand command = new SqlCommand(@"EXEC [dbo].[CTLC_SearchClient] '" + SearchVal + "';");
SqlConnection conn = new SqlConnection(connString);
conn.Open();
command.Connection = conn;
SqlDataReader readers = command.ExecuteReader();
if (readers.HasRows)
{
while (readers.Read())
{
string CliNo = readers.GetString(0);
string CliName = readers.GetString(1);
CliNox.Text = string.Format("<a href='ClientInfo.aspx?ClientNumber={0}'>{0}</a>", CliNo.ToString());
CliNamex.Text = CliName.ToString();
}
conn.Close();
}
This works but when I need to return multiple rows, this only returns 1 row since I only declared 1 for the table body. How can I solve this? Thank you in advance.