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
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.
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!