>I am trying to itirate with a for in a DataRow but i am hitting a road block. ther is no Count property on the DataRow !!
>
>DataSet ds = MyDataSetMethod();
>foreach ( DataRow dr in ds.Tables[0].Rows )
>{
> for (int i ; i < dr.Count ; i++ )
> //Do some stuff
> ;
>}
>
>
>What am i missing ?
Nothing,
Actually you are going to far!
You don't need a count. The datarow is like a record in a table so there is nothing to count or iterate. (Other than fields).
Your foreach is already taking you through all the rows in the table[0].
You can access the fields like this:
dr["MyField"].ToString() ;
If you wanted to use a for instead of a foreach you would get the record count (datarow count) from your table like this: ds.Tables[0].Rows.Count
and reference like this: ds.Tables[0].Rows[i]["MyField"].ToString() ;
Chris