将数据表变量的某一行转换成字符串

构建了一个数据表,需要将数据表第一行转换成字符串,请问该怎么写vb代码?谢谢。

hI @Marginalizer

You have build a datatable using what ?

Regards
Sudharsan

BuildDataTable activity.

@Marginalizer

And you need to convert only the first row to string ?

I 'm unclear of your question

You need to convert the column datatype or you need to change the row

If possible can tell more about your task so that it will be easily understandable

Regards
Sudharsan

Yes, I need to convert the first row of the datatable. This datatable may have only one row or more rows. I know the output activity can convert the whole datatable to string. But I hope to extract the first line.

Okay @Marginalizer

Use this expression in output datatable
DT1.AsEnumerable().take(1).CopyToDataTable this will get you the first row values with the headers
image
image

If you want to get separately use for each row in datatable and pass the dt

  • Assign SameVariable=Current(“ColumnName”).tostring using this you can get all the row values

Regards
Sudharsan

Thank you @Sudharsan_Ka
But how can I get the header only?

Okay after getting that string value use this expression

System.Text.RegularExpressions.Regex.Match(yourString,“.*(?=\n)”).ToString

image

Hope this helps

Regards
Sudharsan

Thank you very much :smiley:

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