Avatar of al4629740
al4629740
Flag for United States of America asked on

Implementing Tuples

I am very new to VB.net.  

In the following code I am trying to implement tuples.  You'll notice in the SQL clause that I pulled [System Name] and Agency ID and I want them to appear as AgencyID &  "-" & [System Name]  in a dropdown list.  I'm figuring that I will use tuples in lstProfiles in order to create the list.  What changes do I need to make in order to make that happen?

 Public Function fetchActiveProfiles() As List(Of String)
        Dim lstProfiles As New List(Of String)

        Dim sqlCmd As String
        sqlCmd = ""
        sqlCmd = sqlCmd & " select [System Name],AgencyID"
        sqlCmd = sqlCmd & " from tblOrgProfile"
        sqlCmd = sqlCmd & " Where Active = 1"
        sqlCmd = sqlCmd & " order by [System Name]"

        Try
            Using con As New SqlConnection(GetConnectionString)
                con.Open()

                Using cmd As New SqlCommand(sqlCmd, con)
                    cmd.CommandType = CommandType.Text

                    Using rs As SqlDataReader = cmd.ExecuteReader()
                        If Not rs.HasRows Then
                            Return lstProfiles
                        End If

                        'rs.NextResult()
                        While rs.Read
                            lstProfiles.Add(rs.GetString(0))
                        End While
                    End Using
                End Using

                con.Close()
            End Using
        Catch ex As Exception
            Throw New DatabaseConnectionException()
        End Try

        Return lstProfiles
    End Function

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
al4629740

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
PortletPaul

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
al4629740

ASKER
Very good solution and that works well.  The purpose of me asking how to do this using tuples was mainly for learning purposes so if its possible for an expert to provide how I might do that using .NET that would be most helpful.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy