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 7785881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:19:37+00:00 2026-06-01T20:19:37+00:00

This question is a follow up to an earlier question I had that was

  • 0

This question is a follow up to an earlier question I had that was quickly resolved. The previous question can be found here: Selecting TOP 4 records from multiple SQL Server tables. Using vb.net

I selected the top 4 rows from multiple SQL tables ordered by date. How would I then go about placing that data into labels. There should be 16 items in total (4 columns, 4 rows). However if I try to use sqldatareader I only get items 0-3 and anything more is outside of the array. Should I not be using an IF statement in this case? Thanks in advance for any assistance. This site is great.

In addition to the newly formed select statement based on the previously linked question, here is what I have:

If dr2.Read Then

        slidelink1.Text = dr2.Item(0)
        slideanchor1.Text = dr2.Item(1)
        slidethumb1.Text = dr2.Item(2)
        slidedate1.Text = dr2.Item(3)
    End If

I appreciate the help guys, as always. Don’t hesitate to tell me if I am way off base here. I’m assuming the reader is only displaying the final row of data, but I’m pretty fresh to this stuff.

  • 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-01T20:19:38+00:00Added an answer on June 1, 2026 at 8:19 pm

    what if you just called Read 4 times.

    If dr2.Read Then
        slidelink1.Text = dr2.Item(0)
        slideanchor1.Text = dr2.Item(1)
        slidethumb1.Text = dr2.Item(2)
        slidedate1.Text = dr2.Item(3)
    End If
    
    If dr2.Read Then
        slidelink2.Text = dr2.Item(0)
        slideanchor2.Text = dr2.Item(1)
        slidethumb2.Text = dr2.Item(2)
        slidedate2.Text = dr2.Item(3)
    End If
    
    If dr2.Read Then
        slidelink3.Text = dr2.Item(0)
        slideanchor3.Text = dr2.Item(1)
        slidethumb3.Text = dr2.Item(2)
        slidedate3.Text = dr2.Item(3)
    End If
    
    
    If dr2.Read Then
        slidelink4.Text = dr2.Item(0)
        slideanchor4.Text = dr2.Item(1)
        slidethumb4.Text = dr2.Item(2)
        slidedate4.Text = dr2.Item(3)
    End If
    

    You could also loop, but if you always know that there are 4 in the result it might be easier to just do it this way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-up on a previous question I had ( Complexity of STL
This is a follow up to my earlier question . Tomcat 5.0.28 had a
This is a follow up to my question earlier here: Android: Autocomplete TextView Similar
This question follows an earlier one . Here is some code that reproduces the
This is a follow up to this question I asked earlier: Why can't I
This is a follow-up to an earlier question here: CakePHP find statement for a
This is a follow-up to an earlier question I had: Combining Survey Items in
This is a follow-up question to this question I asked earlier. Btw thanks Neil
This is a follow-up to an earlier question I posted on EF4 entity keys
This question is a follow up with a previous question Previous Question The previous

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.