Nested loops

Trying to crack down this issue with nested loops.So i’ve got two columns and i want to print out what contains in cells this way:
name1 1
name2 2
name3 3

I read data in columns by using Read Column then i iterate over those two columns using nested loops


Here’s what I can check in output panel, as you see only name1 got printed.
image
How to make it work and print as wished?

Pass the Index while you are iterating like row(0) for column 1. eg: name(0).ToString

@WhenCutEsh
Could you elaborate on that please?

Hi @kuzinyd,

Within a datatable each column has an index( a number starting from 0) assigned to it; also if it has column name you use it to print the values:

dtVariable.Rows.Item(0).ToString() +"-"+dtVariable.Rows.Item(1).ToString()

Or

dtVariable.Rows.Item(Col1Name).ToString() +"-"+dtVariable.Rows.Item(Col2Name).ToString()

Regards,
PD

@kuzinyd as mentioned by @PD2