using Visual.Web.Developer.2010.Express;
using SQL.Server.Management.Studio.2008.R2;
Kinda new at C# here..
I got the first row of the collumn, but how do I retrieve the rest of the values?
I have some textboxes set up, and a sqldatareader putting the first value into the first textbox investigate1. Right now, I have it set up so that all the textboxes are printing out the first row of that collumn.. Stuck at this part.. want to get the others in there to.. The value “a” into investigate1, the value “b” into investigate2, etc.. Thanks for looking
My relevant code
HTML
<asp:TextBox ID="investigate1" class="hexen" runat="server"></asp:TextBox><br />
<asp:TextBox ID="investigate2" class="hexen" runat="server"></asp:TextBox><br />
<asp:TextBox ID="investigate3" class="hexen" runat="server"></asp:TextBox><br />
<asp:TextBox ID="investigate4" class="hexen" runat="server"></asp:TextBox><br />
<asp:TextBox ID="investigate5" class="hexen" runat="server"></asp:TextBox><br />
C#
try
{
ConnFlux.Open();
SqlCommand CmdFlux1 = new SqlCommand("select TbValue from InvestigateValues where TbId = '1'", ConnFlux);
RdrFlux1 = CmdFlux1.ExecuteReader();
while (RdrFlux1.Read())
{
investigate1.Text = RdrFlux1.GetValue(0).ToString();
investigate2.Text = RdrFlux1.GetValue(0).ToString();// What would I have
investigate3.Text = RdrFlux1.GetValue(0).ToString();// to change about these
investigate4.Text = RdrFlux1.GetValue(0).ToString();// to print the corresponding
investigate5.Text = RdrFlux1.GetValue(0).ToString();// values to the corresponding textbox?
}
}
sqldb
Yes, these are the only two columns in this database

Rather than using 5 separate TextBox controls, you may want to investigate using a Repeater control. The Repeater control will be able to handle cases when you have more or less than 5 records in your database.