Datatable into string

Hi,

String.Join(Environment.Newline,MyDataTable.Rows.Cast(of DataRow). Select (function(row) string.join(" ",row.itemArray))).

I have used this syntax to convert the Datatable into string with tab space in between and writes into txt file. This syntax has worked fine for few times and after few runs, instead of tab space between strings, only single space is present in between the strings.
Again i have removed the syntax and pasted the same. Worked fine for first few times and again the cycle continues.
Why the same line of code working properly for the first few times and giving the different output after .

Can someone help me with the reason and also the resolution for this.

Thanks in Advance,
Sai Charan Goud Konda

1 Like

Have you tested with vbTab instead?

String.Join(vbTab, row.ItemArray)

Hey @Konda_Sai_Charan_Goud

You can use \t or vbTab which should be more cleaner way !

Hope that helps.

Thanks
#nK

Hello @Konda_Sai_Charan_Goud ,

Do you want to just convert the Datatable to string or you want to retain the format as well.

Did you tried Output datatable activity?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.