Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Number of rows returned by a DataReader

$
0
0
Hi, Is there any way to know how many rows the data reader returns after executing a SQL statement? For now, I am doing the follwing:if datareader.hasrows then while datareader.read count += 1 end while end ifBut this method has its own problems. I think the "hasrows" property messes with the "read" method somehow, because if my datareader returns just 1 row, then it enters the if statement above, but doesn't go into the while statement!! Strange!!! please help if you can. Thanks a lot.

Viewing all articles
Browse latest Browse all 1698

Trending Articles