Should I call SqlDataReader.HasRows if I am calling SqlReader.Read

Be careful. HasRows() returns false for my CTE query, even though there are rows (437 rows actually).


No..It is not mandatory to check (dr.HasRows) if the DataReader contains any row or not.

Read() will return False if there are no more rows to fetch, but Reader.HasRows is much more telling as to what it does than Read() so it would be a good practice to use Reader.HasRows because you may accidentally do something other than Read() which may fall into exception.