Get the number of rows returned by OleDbDataReader ASP.NET (VB)

After connecting to the database using DataReader, how can I calculate the quantity rows?

Thank.

+3
source share
2 answers

Reading data is only forward, therefore, they do not have a counter at the first filling. You can do several things to solve this problem:

  • Run a separate command to get the score OR using NextResult to help instead of a completely separate command).
  • Scroll through the results and count the entries
  • Use DataSet

Here is example # 1:

Without NextResult: http://www.devx.com/vb2themax/Tip/18807

NextResult ( , , NextResult): http://bytes.com/topic/asp-net/answers/295793-datareader-nextresults-question

№ 2: http://support.microsoft.com/kb/308050

+4

Read().

A DataReader - .

+2

Source: https://habr.com/ru/post/1750603/


All Articles