dataset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to count the number of rows in a datset called dsBooks I have an access DB named HomeBooks with a table name book
I am using this code to count the number of rows in the datase

"Dim holdmycoun
holdmycount = dsBooks.books.Rows.Count +
msgbox (Holdmycount)

When I run it, the message box always shows 1. Even though there are 10 rows presently in the dataset/access databas
The message box should be saying 1
I need help
 
Hi Sam,

I do not see direct an error.

Maybe it will help to Set "Option Strict On" in the top of your program

Then the code can be something as just

messagebox.show((dsBooks.books.Rows.Count + 1).ToString)

Try it and reply when this does not work (and when it works as well)?

Cor
 
Hi,

Two suggestions. First declare holdmycount as an integer. Second
dsbooks.tables("books") instead of dsbooks.books

Dim holdmycount as integer
holdmycount = dsBooks.tables("books").Rows.Count + 1
msgbox (Holdmycount)

Ken
--------------------
 
Back
Top