Subject | How do I read a specific range of records from a table in the database |
---|---|
Author | HotRodRudy |
Post date | 2013-01-21T19:59:19Z |
Support,
I am using Firebird server 2.5.2, Windows 7, and Visual Basic 2010.
I would like to read a certain # of records from a table in the database using a start / stop record range. I am trying to re-write an application written by someone else which reads the entire database from beginning to end which takes a long time and I may only need the last 1000 records of a database that can have over 100,000.
I have been using the following to determine the total number of records in the database so I should be able to use it to establish a range.
'Find the total number of records in the SURFACE table
Dim count As FbCommand = New FbCommand("SELECT COUNT(*) FROM ( select * from SURFACE )", fbc)
Dim readCount As FbDataReader = count.ExecuteReader
readCount.Read()
lastDbRecord = readCount.GetValue(0) ' Get the total number of records in this database
I am using Firebird server 2.5.2, Windows 7, and Visual Basic 2010.
I would like to read a certain # of records from a table in the database using a start / stop record range. I am trying to re-write an application written by someone else which reads the entire database from beginning to end which takes a long time and I may only need the last 1000 records of a database that can have over 100,000.
I have been using the following to determine the total number of records in the database so I should be able to use it to establish a range.
'Find the total number of records in the SURFACE table
Dim count As FbCommand = New FbCommand("SELECT COUNT(*) FROM ( select * from SURFACE )", fbc)
Dim readCount As FbDataReader = count.ExecuteReader
readCount.Read()
lastDbRecord = readCount.GetValue(0) ' Get the total number of records in this database