Monday, December 03, 2012 5:58 PM
I’m confused a bit on how to tell if a reader has rows (the docs don’t it make any clearer…)
Single empty result set:
var rc = await reader.ReadAsync();
I assume rc == true means I have rows so it’s not necessary to check reader.HasRows again.
But what about multiple result sets?
var rc = await reader.NextResultAsync();
Does rc == true mean I have rows?
What’s the return value semantics?
Do I need to test the next call to reader.ReadAsync() again? or should I check reader.HasRows before advancing the reader?
So basically, what’s the best practice to exit early?
- Moved by Iric Wen Wednesday, December 05, 2012 9:02 AM (From:SQL Server Data Access)
Wednesday, December 05, 2012 9:00 AM
Thursday, December 06, 2012 7:00 AMModerator
Welcome to the MSDN forum.
Please check this blog about Using SqlDataReader’s new async methods in .Net 4.5: http://blogs.msdn.com/b/adonet/archive/2012/04/20/using-sqldatareader-s-new-async-methods-in-net-4-5-beta.aspx
Here is an example to help you to understand: http://blogs.msdn.com/b/adonet/archive/2012/07/15/using-sqldatareader-s-new-async-methods-in-net-4-5-beta-part-2-examples.aspx
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked As Answer by Alexander SunModerator Wednesday, December 26, 2012 2:02 AM