|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Loop through columns of all datarows in a datasetI have a dataset that I queried from an excel sheet. I want to loop through
the rows, then loop through the columns and write them to a file. But I got stuck pretty quickly: So far: For Each dr As DataRow In Order.Tables(0).Rows Next In this for each I want to start a second for each for the columns. But it seems that a datarow does not have a columns collection I can loop through? How can I loop through the colomns in each datarow?
Show quote
Hide quote
"Philip Wagenaar" <philip.wagenaar@online.nospam> schrieb You mean the column values?> I have a dataset that I queried from an excel sheet. I want to loop > through the rows, then loop through the columns and write them to a > file. But I got stuck pretty quickly: > > So far: > > For Each dr As DataRow In Order.Tables(0).Rows > > Next > > In this for each I want to start a second for each for the columns. > But it seems that a datarow does not have a columns collection I can > loop through? > > How can I loop through the colomns in each datarow? for each value as object in dr.itemarray - or - for each col as DataColumn in Order.tables(0).columns dim value as object value = dr(col) next col Armin Philip,
The datacolumn describe the items from the rows. For Each dr As DataRow In Order.Tables(0).Rows For each it as object in dr.ItemArray ' next Next I hope this helps, Cor Show quoteHide quote "Philip Wagenaar" <philip.wagenaar@online.nospam> schreef in bericht news:95CBF6A7-1613-4023-83EF-3537ADF842DA@microsoft.com... >I have a dataset that I queried from an excel sheet. I want to loop through > the rows, then loop through the columns and write them to a file. But I > got > stuck pretty quickly: > > So far: > > For Each dr As DataRow In Order.Tables(0).Rows > > Next > > In this for each I want to start a second for each for the columns. But it > seems that a datarow does not have a columns collection I can loop > through? > > How can I loop through the colomns in each datarow? > >
Reading Stream After RedirectStandardOutput=True Blocks
I can't find the error here.... Serial Date Stored procedure handling 1 parent record and multiple child recor vb.net to c# conversion help please Converting Base 2 Numbers to Base 10 my form cannot from from network Problems using HasMorePages with oleDbDatareader Hide some columns of listview Question re byte arrays and strings |
|||||||||||||||||||||||