In dr i select the 102 rows from datatable.
Now i need to loop the first 100 dr values.I use the following for each loop its shows error like " cannot convert type datarow to int)
First i can take the 100 rows and process some logic after that logic i need to remove from the first 100 values from dr.after that i need to pick up the remaining 2 values.
DataRow[] dr = dtSourceDetail.Select("fld_description = '"+desc+"' ");
foreach(int i in dr.Take(100))
{
//process some logic
//here need to remove the first row from dr.
}
How can i do this?
You need to change the type in the
foreach
toDataRow
A
foreach
will try and cast each item that it receives from the enumerator to the type that you provide in the statement. In this case you provideint
. It receives the firstDataRow
and then tries to cast it, which is where it is failing.