connect strngs read form a database

Chris Jones
Chris Jones used Ask the Experts™
on
Hello

i am trying to connect some strings from my database for exmpale

test
test123
test1234
1234
test

into a string that looks like this....

"'FGRD', 'REV1', 'RFP1', 'RFD1', 'RMAN', 'RPLS'"

NOTE: i have the items in a listarray.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I think your question itself is using confusing terms, I assumed you are talking about concat.

Try this sample:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim x As New ArrayList
        x.Add("ABC")
        x.Add("-EFG")
        x.Add("-HIJ")

        Dim y As Integer
        Dim Test As String = ""
        For y = 0 To (x.Count - 1)
            If y = (x.Count - 1) Then
                Test += "'" & x.Item(y) & "'"
            Else
                Test += "'" & x.Item(y) & "'" & ","
            End If
        Next
        MsgBox(Test)
    End Sub
Most Valuable Expert 2012
Top Expert 2014

Commented:
>i am trying to connect some strings from my database for exmpale
>NOTE: i have the items in a listarray.

As said above, confusing. Are you trying to create a list of values for IN clause?
Chris JonesLead Application Web Developer

Author

Commented:
i just have a set of strings in my vb program that are in an array list and i need theme seperated inti tghe exmpale i posted above the values are just tests.
Chris JonesLead Application Web Developer

Author

Commented:
What you provided seems to work great
Chris JonesLead Application Web Developer

Author

Commented:
That was very fast thanks for your quick reply...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial