Welcome to WebmasterWorld Guest from 3.227.233.55

Forum Moderators: ocean10000

Message Too Old, No Replies

DataReader to Label

     
1:45 pm on May 26, 2009 (gmt 0)

New User

10+ Year Member

joined:Nov 15, 2008
posts:8
votes: 0


Hello all! I'm having trouble remembering how to have the results of a datareader bound to a label. I've been doing some searching on the internet and I can't seem to find the right answer. Here's the code I'm using right now. I know the bold area is where i'm having trouble.

In addition, should I be using a DataGrid instead of a DataReader in this case?

private void LoadManualUsage()
{
SqlConnection conn = new SqlConnection(
"connection details here");
SqlCommand comm = new SqlCommand(
"Select column1, column2, column3, column4 * From someTable where processStatus = 1", conn);
SqlDataReader reader;
try
{
conn.Open();
reader = comm.ExecuteReader();
while (reader.Read())
LDCUsageLabel.Text += reader.();

reader.Close();
}
catch
{
Response.Write("Error gathering table data.");
}
finally
{
conn.Close();

}
}

4:00 pm on May 27, 2009 (gmt 0)

New User

10+ Year Member

joined:Nov 15, 2008
posts:8
votes: 0


nevermind, i figured out what i need and decided to use a repeater control.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members