Parse CSV string and perform select & listbox display
Posted on 2011-09-05
I have strCardIDs = "1,1,2,2,2,2,3,3,4,1,1,8,8,3,3,3,4,4,4,4,5,6,7,7,7,7,7,7,7,8" (this is retrieved from field in db)
These are the IDs of each of the Cards.
I have table Cards that look like this
I have a listbox, lstCards
I want to display the following (the card title, and the quantity of each card as a sum of the number of times it's ID appears in the list. Please note, ID of card could appear anywhere in the string. that is, ID 1 could also appear at the end of the string as well as at the beginning, or in the middle):