Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

foreach with new DataTable

Status
Not open for further replies.

lutzs

Programmer
Oct 8, 2002
75
LU
Hi,

i've created a new dataTable in my dataSet. It works fine, I can see the data with the dataGrid.
Now, I will read some rows of this table.
I use a foreach- statement:

foreach(DataRow dr_devise in dataSet.t_test.Rows)
{
...
}
But however nothing happens.
Is this table not recognized?

What can I do?

Thanks, Stephanie
 
Use the object viewer (Ctrl+Alt+J) to see if your dataTable implements either IList or IEnumerable interfaces (IList includes IEnumerable, but I can't recall if it'll show up separately).

You need IEnumerable in order to use the foreach() keyword.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top