wolfrose
asked on
recordset troubles
I am attempting to bind an MSHFlexgrid with records from a database, but I am encountering the following problem:
The database recordset contains over 25000 rows.
Setting the Recordset property of the flexgrid to a db.Execute query yields only the column headers, no records.
Setting the Recordset property to an already filled recordset limits the rows to 2049 (2048 + column header line)
My code is below. Does anyone have any idea why I am getting this problem and how to correct it?
Public db As ADODB.Connection
Public dbr as ADODB.Recordset
Public Sub Connect()
Dim strConn As String
Dim strQuery as string
Dim dbCustomers
strConn = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=C:\MyDatabase.mdb"
Set db = New ADODB.Connection
db.Open strConn
strQuery = "SELECT Record_ID,Sorting_ID FROM Customers ORDER BY Record_ID"
'Method 1: Bind Recordset Property to Recordset (dbr fills with all the Rows, MSHFlexgrid1 contains only 2049 rows)
Set dbr = New ADODB.Recordset
dbr.Open strQuery, db, adOpenKeyset, adLockOptimistic
Set MSHFlexgrid1.Recordset = dbr
'Method 2: Bind Recordset Property to db.Execute Query (MSHFlexgrid1 contains only the column headers - no rows)
Set MSHFlexgrid1.Recordset = db.Execute(strQuery)
End Sub
The database recordset contains over 25000 rows.
Setting the Recordset property of the flexgrid to a db.Execute query yields only the column headers, no records.
Setting the Recordset property to an already filled recordset limits the rows to 2049 (2048 + column header line)
My code is below. Does anyone have any idea why I am getting this problem and how to correct it?
Public db As ADODB.Connection
Public dbr as ADODB.Recordset
Public Sub Connect()
Dim strConn As String
Dim strQuery as string
Dim dbCustomers
strConn = "Provider=Microsoft.Jet.OL
Set db = New ADODB.Connection
db.Open strConn
strQuery = "SELECT Record_ID,Sorting_ID FROM Customers ORDER BY Record_ID"
'Method 1: Bind Recordset Property to Recordset (dbr fills with all the Rows, MSHFlexgrid1 contains only 2049 rows)
Set dbr = New ADODB.Recordset
dbr.Open strQuery, db, adOpenKeyset, adLockOptimistic
Set MSHFlexgrid1.Recordset = dbr
'Method 2: Bind Recordset Property to db.Execute Query (MSHFlexgrid1 contains only the column headers - no rows)
Set MSHFlexgrid1.Recordset = db.Execute(strQuery)
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER