Counting rows in an access database (RESOLVED)
Hello. I would like to know if there is any way to get the number of rows in an access database. I want to do something where I connect to an access database and read through the rows and add each row to a listview control. The database will eventually get very large, so I want to use a progress bar to let the user know how much longer it is going to take. So I want the project to get the number of rows in the data base, then I will set the maximum of the progress bar to that number. While looping through each record, I will add 1 to the value property of the progress bar, thereby moving the progress bar to the right until the datareader is finished. Here is my code. I will highlight the line of code that I am missing/don't know how to do.
VB Code:
Dim SelectQuery As String = "SELECT * FROM EntireLogbook"
Dim OleDbConnection As New OleDbConnection(ConnString)
Dim OleDbCommand As New OleDbCommand(SelectQuery, OleDbConnection)
Dim OleDbDataReader As OleDbDataReader
[COLOR=red]prbLoadProgress.Maximum = ????[/COLOR]
OleDbDataReader = OleDbCommand.ExecuteReader
prbLoadProgress.Visible = True
While OleDbDataReader.Read
Dim lviNewRecord as new ListViewItem()
[COLOR=green]'Adding subitems to listviewitem[/COLOR]
lstSequence.Items.Add(lviNewRecord)
prbLoadProgress.Value +=1
End While
prbLoadProgress.Visible = False
OleDbDataRreader.Close
OleDbConnection.Close
Counting records from an access database (RESOLVED)