Question convert datarow to strings.

Maleki

New member
Joined
Sep 15, 2008
Messages
2
Programming Experience
10+
I'm writing an app in VB.Net 2008 that needs to transpose a list of values in a database.

I found that the Join command will just do that. :D Only works on arrays though.

The dataset only has one column. So I'm trying to find an elegant way of converting it to an array. I've got 18000 rows or so so I'd like to avoid looping through columns if at all possible.

My data more or less looks like this:

user_name
user_birthday
user_flavour

and I'd like to convert it to this:

user_name, user_birthday, user_flavour

Thanks in advance,

M
 
Last edited:
VB.NET:
Dim sb as New StringBuilder(100000) 'guessed at suitable initial capacity - you may have better idea
ForEach ro as YourDataRow in YourDataTable 'use of types "YourXXX" implies you have a strongly typed datatable. you will need to alter these names
  sb.Append(ro.YourColumnname).Append(", ") 
Next ro
sb.Length -= 2 'remove the trailing comma
 
Back
Top