Results 1 to 5 of 5

Thread: Counting rows in an access database (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Miami FL
    Posts
    38

    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:
    1. Dim SelectQuery As String = "SELECT * FROM EntireLogbook"
    2. Dim OleDbConnection As New OleDbConnection(ConnString)
    3. Dim OleDbCommand As New OleDbCommand(SelectQuery, OleDbConnection)
    4. Dim OleDbDataReader As OleDbDataReader
    5.  
    6. [COLOR=red]prbLoadProgress.Maximum = ????[/COLOR]
    7.  
    8. OleDbDataReader = OleDbCommand.ExecuteReader
    9. prbLoadProgress.Visible = True
    10. While OleDbDataReader.Read
    11.      Dim lviNewRecord as new ListViewItem()
    12.      [COLOR=green]'Adding subitems to listviewitem[/COLOR]
    13.      lstSequence.Items.Add(lviNewRecord)
    14.      prbLoadProgress.Value +=1
    15. End While
    16. prbLoadProgress.Visible = False
    17. OleDbDataRreader.Close
    18. OleDbConnection.Close
    Last edited by WannabePBA; Mar 17th, 2004 at 12:23 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width