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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:00:28+00:00 2026-06-03T15:00:28+00:00

I believe in JAVA we can set the data reader to point to the

  • 0

I believe in JAVA we can set the data reader to point to the 1st row of it’s result set. I have a SQLDataReader that has over 20 columns and I need to pre-process some columns and calculate some values before I use the entire result set. Is it possible to re-read the data reader after reading it for the first time to get just selected columns? Or will I need to store the results in a data table and read from it later?

  • 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-03T15:00:30+00:00Added an answer on June 3, 2026 at 3:00 pm

    From the MSDN docs at http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx

    Provides a way of reading a forward-only stream of rows from a SQL Server database.

    You can read one row at a time, but you cannot go back to a row once you’ve read the next row.

    You can read columns in a row in any order, any number of times, and skip fields if you want.

    while (reader.Read())
    {
        var a = reader[2];   // you can skip fields
        var b = reader[0];   // you don't have to read the fields in order
        var c = reader[2];   // you can re-read fields
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some work with the stackoverflow data set in Java and have a
Java's checked exceptions sometimes force you to catch a checked exception that you believe
I'm getting a java.awt.FontFormatException: Unrecognised Font Format error, and I believe this has been
I believe the application has some parts that target .NET, and some that don't.
I have a web app built with html5 boilerplate that has multiple skins available.
I have a number of Java Server Pages set up already and I would
I'm an experienced Java programmer that for the last two years have programmed for
Java and C# support the notion of classes that can't be used as base
I have a Big O notation question. Say I have a Java program that
can't believe I am losing so much time on this one. I have an

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.