foreach with SqlDataReader?
<p>I have the following code:</p>

<pre><code>SqlDataReader reader = getAddressQuery.sqlReader;
while (reader.Read())
{
    foreach (Object ob in reader)
    {
        someText.InnerText = someText.InnerText + " " + ob.ToString();
    }
}
</code></pre>

<p>The code in the foreach loop does not execute. However, I can do this:</p>

<pre><code>SqlDataReader reader = getAddressQuery.sqlReader;
while (reader.Read())
{
    someText.InnerText = reader[0].ToString();
}
</code></pre>

<p>Which works.</p>

<p>Obviously I could achieve the same result using a regular for loop rather than a foreach loop, but I think the foreach syntax is clearer, so I use it when possible.</p>

<p>What has gone wrong here? Are foreach loops in c# not as flexible as in more high level languages?</p>
