View Single Post
 
Old April 26th, 2005, 10:55 AM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Although the String.Split method might be ok in isolated test conditions, there is always the threat of getting data that contains a character that you are splitting on (particularly a common one like ,). Instead of relying on a certain character in a concatenated string you can just build the array on the spin thru your data table. Also, concatenating a string in the way you are is not the most efficient method.

Instead, I'd recommend using the System.Collections.Specialized.StringCollection class to build your list of items from the database. It functions just like the ArrayList collection (such that you can add items on the fly) but works with the String type instead of the Object type so you don't need to do any type conversions. You'll just need to modify the recursion function to deal with that class instead of an array of strings.

-Peter