by
0
7
2,905
1
Top 1% !
Popular
Famous
Easy-to-find
Specified
Refined
OpenSource
Popularity: 4913rd place
.NETFramework4.5
Architecturex86_64
Extension.cs
InputName0Reader
InputType0OleDbDataReader
LanguageCSharp
MethodNameCountRows
OutputTypeint

Count Rows of DataReader

Simple function to count rows of a OleDbDataReader, returns positive integer or -1 if error
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/812449/Count-Rows-of-DataReader?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static int CountRows(this OleDbDataReader Reader) { int cnt = 0;try{ while (Reader.Read()) { cnt++; } return cnt; }catch (Exception) { return -1; } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus