Loop through -columns- on a dataview?

Hi there,

I’m thinking about an application where I might look at the columns on a row’s worth of a dataview and pick out, say, all the fields associated with a group box for processing.

Has anyone done something like this?

Thanks,

Joe

Here an example how to loop trhou rows in Order Release table in a dataView

for ( int RelCount = 1; RelCount <= TotalRel ; RelCount++ )
{
edvOrderRel.dataView.RowFilter=“OrderLine=”+RelCount.ToString();
edvOrderRel.dataView[0][“BuyToOrder”]=true;
edvOrderRel.dataView[0][“VendorNumVendorID”]=etbVendorID.Text;
edvOrderRel.dataView[0][“VendorNumName”]=etbVendorName.Text;
oTrans.Update();
}

Hi Jackie,

Thanks for the info. What I’m looking for at the moment is a way to loop
through the columns instead of the rows–to get all of the field names in a
dataview. I haven’t seen that done.

Joe

Ah! so easy

foreach (DataColumn dataColumn in dataView.Table.Columns)
{
MessageBox.Show(dataColumn.ColumnName.ToString());
}

Cool! Thanks, Jackie.

Joe

And my apologies for getting your name wrong. Twice! :-/

Thanks again for your help!

Joe