---
title: "DataReader.HasRows"
url: "https://osherove.com/blog/2003/7/28/datareaderhasrows.md"
canonical: "https://osherove.com/blog/2003/7/28/datareaderhasrows.html"
published: "2003-07-28T12:04:00"
updated: "2003-07-28T12:04:00"
tags: [".Net Original"]
author: "Roy Osherove"
description: "One of the annoying things in version 1.0 of the .net framework was regarding the DataReader (Ole DB or SQL) class. You had no way of knowing whether the reader you got was pointing to any data or has no rows. You had…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# DataReader.HasRows

By Roy Osherove July 28, 2003 In [.Net Original](https://osherove.com/blog/category/net-original)

**Historical article** · Originally published July 28, 2003; technical details may be outdated.

One of the annoying things in version 1.0 of the .net framework was regarding the _DataReader_ (Ole DB or SQL) class. You had no way of knowing whether the reader you got was pointing to any data or has no rows. You had to manually try to read from it and check if nothing had been returned. Very flaky.

Apparently it is not common knowledge beacause someone asked me this, but  In v1.1 this has been sorted out. Every _DataReader_ object now has a _HasRows_ property that returns a Boolean. Phew!

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Jul 28, 2003

    ### [About coding standards](https://osherove.com/blog/2003/7/28/about-coding-standards.html)

- Jul 28, 2003

    ### [Nasty bug in Data Access Block Ver. 2.0](https://osherove.com/blog/2003/7/28/nasty-bug-in-data-access-block-ver-20.html)

- Jul 28, 2003

    ### [Filling typed datasets using Data Access Application Block v.2.0](https://osherove.com/blog/2003/7/28/filling-typed-datasets-using-data-access-application-block-v.html)

- Jul 28, 2003

    ### [Checking for NULL values](https://osherove.com/blog/2003/7/28/checking-for-null-values.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
