0

I got a value from table:

zs_code  zs_name
   a      James
   b      John
   c      Mikael

i want to convert the zs_name column to one string to be like below:

["James", "Mikael", "John"]

mean the string value is like above.

may anyone help me?

2 Answers 2

1
Dim items = String.Join(",", yourTable.AsEnumerable().[Select](Function(row) row.Field(Of String)("zs_name")))
Dim result = String.Format("[{0}]", items)
Sign up to request clarification or add additional context in comments.

Comments

0

Try like this:

string[] arr = new string[dt.Rows.Count];
for (int i = 0;i<dt.Rows.Count;i++)
{
 arr[i] = dt.Rows[i]["zs_name"].ToString();
}

Source : this link

Happy coding!!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.