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

  • Home
  • SEARCH
  • 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 345787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:07:00+00:00 2026-05-12T11:07:00+00:00

I was thinking that the SQLDataReader should not work if there is no connection

  • 0

I was thinking that the SQLDataReader should not work if there is no connection to the SQLServer.

I experimented this scenario. I execute the ExecuteReader then stop the SQLServer Service and tried to iterate through the DataReader. What I expected was an exception, but it gave the results one after the other. Ideally the DataReader should read one row at a time from the stream that gets connected to the DB server and which should throw an exception if we disconnect the DB server?

I don’t know, What is it that I am missing here.

  • 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-05-12T11:07:00+00:00Added an answer on May 12, 2026 at 11:07 am

    I strongly suspect that the reader reads a batch of results at a time. That’s a lot more efficient than one row at a time (think about the situation where a single row is only a few bytes… you don’t want a network packet per row when it could have retrieved lots of rows in a single packet). It also potentially allows the database to release its internal resources early – if the data reader has read all the results (when there are only a few) it can effectively forget about the query.

    I suspect if you try the same type of thing with a query returning lots of results, you’d get the expected exception.

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

Sidebar

Related Questions

I've been always thinking that DOMNodeInsertedIntoDocument/DOMNodeRemovedFromDocument events should not bubble, and for me that
Am I right in thinking that this may not be the best idea: private
Thinking that the answer to this is pretty obvious but here it goes: When
I'm thinking that the reason I can't do this is because it might be
Am I right in thinking that there's only ONE icon included in google maps,
I'm thinking that someone might of already solved this problem. I tried to look
I'm thinking that I should put them in C:\ProjectName\src\main\resources\com\company\projectname\icons but I want to be
Is everybody thinking that everybody else doesn't release softwares as jar and then releases
I did a search for this question thinking that somebody must have asked it
This is related to this question . It got me thinking that, for example,

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.