Row-wise vs columnwise

  • Thread starter Thread starter John Dann
  • Start date Start date
J

John Dann

If I need to iterate through all the field values in a dataset, is
there any preference for organising the outer iterations by row or by
column . ie should I do (in VB.Net):

For i as integer = 1 to table(0).columns.count
For j as integer = 1 to table(0).rows.count
.........
Next j
Next i

or swap columns or rows, or is it immaterial?

TIA
JGD
 
Hi John,

I would organise it by row and then by column - makes more sense to me.
 
it should not make any difference, it just depends how you want to access
the Data: Row based or Column based

Col1 Col2
Row1 1 2
Row2 3 4

lets say for above table you want to display the data on screen, you will
see following output

(Row Based: outer loop is on Datarow) 1 , 2 , 3 , 4
(Column based, outer loop is on DataColumn) 1 , 3 , 2 , 4
 
Back
Top