Friends,
I have a table in the DataBase that have a column with repeated values...
Example
| ID | Values | RepValues |
| 1 | 5 | 1 |
| 2 | 3 | 2 |
| 3 | 7 | 2 |
| 4 | 2 | 2 |
| 5 | 9 | 3 |
| 6 | 1 | 3 |
I do a SELECT like this:
commSELECT = new SqlCommand("SELECT Values FROM contResults WHERE RepValues
= 2 ORDER BY id", conn);
THEN
try
{
conn.Open();
readerSELECT = commSELECT.ExecuteReader(CommandBehavior.CloseConnection);
readerSELECT.Read();
labelResultados.Text += "<i>- " + readerSELECT["contResults"] + "
things</i><br />";
readerSELECT.Close();
It results in:
- 3 things
And what I want is:
- 3 things
- 7 things
- 2 things
What I have to do?
Thanks
Sorry my english
Grillo
Alexey Smirnov - 12 Nov 2007 19:02 GMT
On Nov 12, 7:56 pm, "Guilherme Grillo" <web...@rncomtotal.com.br>
wrote:
> Friends,
>
[quoted text clipped - 47 lines]
>
> Grillo
instead of readerSELECT.Read(); use
while (readerSELECT.Read()) {
....
}
bruce barker (sqlwork.com) - 12 Nov 2007 19:09 GMT
you need to read more than 1 row. try this new fangled feature called a while
loop:
while (readerSELECT.Read())
{
labelResultados.Text += "<i>- "
+ readerSELECT["contResults"]
+ " things</i><br />";
}
-- bruce (sqlwork.com)
> Friends,
>
[quoted text clipped - 47 lines]
>
> Grillo