@indra
row is representing the datarow within a For Each or an individual datarow variable.
Unless you are wanting to loop through each column (which you would need 2 For Each; one for Rows and one for Columns), you should do the For Each for rows, then for column use the header name or index of the column.
Foreach row in dtSqlQuery.Rows Write line row(“columnname1”).ToString+row(“columnname2”).ToString+row(“columnname3”).ToString+row(“columnname4”).ToString+row(“columnname5”).ToString
That is faster, however alternatively you can use your For Each Column
Foreach row in dtSqlQuery.Rows Foreach column in dtSqlQuery.Columns Write line row(column).ToString
hello @ClaytonM
I was also having a doubt regarding the same topic. And your answer was of great help. THANKS a lot…
but there still there is a small issue. When I used write line :"row(“columnname1”).ToString+row(“columnname2”).ToString+row(“columnname3”).ToString " it is working fine, but in the alternate method u have provided,
how will we use both “foreach row and foreach column” to get the columns?
I am getting validation errors!
I think the alternative method is better because giving the column names each time is a tiresome job…
Thanks for the quick reply. I am still having the error! Cant change the variable type to “DataColumn” because the previous output is “Datatable” which is the same variable I am using in the ‘For Each Activity’ . When I use “row(colums).Tostring” , it is throwing this error : ( open strict on dissalows late binding ) !
Again thanks in advance, pardon me as If I am asking too much basic stuff… I’ve just started to learn about vb scripts !!
what if I need the whole row at a time in an array.
so for example first it gives me (JED,JHRGD, EUR, )
so that I can save it in an array and later use the values need for my process.
Thank you in advance