Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:12:36+00:00 2026-06-14T21:12:36+00:00

Previous to my other question, I now have another item I need to resolve

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:12:37+00:00Added an answer on June 14, 2026 at 9:12 pm

    Assuming:

    • your stored procedure returns the items ordered by subject field
    • and you have many items for subject=F23 and subject=F06
    • you need to build a list of the same items grouped by subject

      Dim titleF23 as String = "<h1>Access to HE</h1>"
      Dim titleF06 as String = "<h1>Art and Design</h1>"
      
      While rsData.Read()
      
          If (rsData("subject") = "F23") Then
              if titleF23.Length > 0 then 
                   html += titleF23
                   titleF23 = ""
              end if
              html += "<p>" & rsData("name") & "</p>"
              html += "<p>" & rsData("level") & "</p>"
      
          ElseIf (rsData("subject") = "F06") Then
              if titleF06.Length > 0 then 
                   html += titleF06
                   titleF06 = ""
              end if
              html += "<p>" & rsData("name") & "</p>"
              html += "<p>" & rsData("level") & "</p>"
          End If
      
       End While
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Carrying on from my previous question, which has now been solved: Issue with Pointers
Following up on my previous newbie question about Paypal , I have a new
This question was bugging me for quite a while (as evidenced by my previous
This stems from a previous question I asked regarding code metrics. I have been
Using an idea from a previous question I have created a gantt-like chart using
A follow-up to my previous question. I have a button on my stage, which
Assume I have some class in my project. Now I create another Class library
This question follows another, just solved here Now I want to do a different
I have been using iCloud in my apps for a while now and am
This question follows on from a previous question which can be found here: Need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.