View Single Post
Old 09-14-2004, 05:35 AM   #1 (permalink)
moskie_work
Upright
 
[VB.Net] Creating a comma seperated value list with single quotes...

I am trying to go through all the parameters from a certain multi-select box of the request object and generate a CSV list with each value wrapped in a pair of single quotes. What I have is:

Code:
ChmclsCSV = ""

        For Each p In Request.Params.Keys
            If p = "sltChmcl" Then
                If ChmclsCSV.Length = 0 Then
                    ChmclsCSV = "'" & Request.Params(p).ToString() & "'"
                Else
                    ChmclsCSV = ChmclsCSV & " , '" & Request.Params(p).ToString() & "'"
                End If
            End If
        Next

        Trace.Write("Chemicals List:" & ChmclsCSV)
Trace gives me the output of:

Chemicals List:'100-01-6,100-41-4,100-42-5'


Those are the right values, but you can see that there should be more quotes between each of the values. Anyone know what's going on?
moskie_work is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73