Previous to my other question, I now have another item I need to resolve with my Do while/if statements.
strSQL = "exec sp_CoursesStartingSoon"
objConn = New SqlConnection(strConnection)
objConn.Open()
objCmd = New SqlCommand(strSQL, objConn)
rsData = objCmd.ExecuteReader(0)
While rsData.Read()
If (rsData("subject") = "F23") Then
html += "<h1>Access to HE</h1>"
html += "<p>" & rsData("name") & "</p>"
html += "<p>" & rsData("level") & "</p>"
ElseIf (rsData("subject") = "F06") Then
html += "<h1>Art and Design</h1>"
html += "<p>" & rsData("name") & "</p>"
html += "<p>" & rsData("level") & "</p>"
End If
End While
Now the issue I have is that I need the H1 titles to only appear once, currently they are within the While loop so are looping on every row. Can anyone provide a suggestion on how to do this?
Thanks!
Assuming:
subjectfieldyou need to build a list of the same items grouped by subject