I have out of memory when fill the array, but only with 122.658 items, other numbers of item is ok...
...
Erase strDBRows()
strDBRows = RST0.GetRows()
...
i fill the getrow () from a select query with 21 fields
Note:
i have dimensioned with Dim strdbrows() without As statement... peraphs the variable assume to the defualt Variant? is this the problem?
OUT of memory in array
-
- Administrator
- Posts: 78625
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: OUT of memory in array
The declaration isn't the problem - the array must be of type Variant here, since the fields can be of different data types.
The memory usage of the array depends on the size of the records - 21 text fields filled with long strings take up much more space than 21 number fields.
The memory usage of the array depends on the size of the records - 21 text fields filled with long strings take up much more space than 21 number fields.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4370
- Joined: 26 Apr 2010, 17:36
Re: OUT of memory in array
ok instead to store getrow in the array how to loop directlly the RST0.GetRows?HansV wrote:The declaration isn't the problem - the array must be of type Variant here, since the fields can be of different data types.
The memory usage of the array depends on the size of the records - 21 text fields filled with long strings take up much more space than 21 number fields.
-
- Administrator
- Posts: 78625
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: OUT of memory in array
If the recordset is too big to read into memory all at once, you will have to loop through the records using
Code: Select all
Do While Not RST0.EOF
... ' your code here
RST0.MoveNext
Loop
Best wishes,
Hans
Hans
-
- SilverLounger
- Posts: 2403
- Joined: 05 Feb 2010, 22:21
- Location: London ENGLAND
Re: OUT of memory in array
Alternatively, GetRows() has parameters to allow you to extract a number of rows, and also to specify specific fields. You could put this in a loop to extract blocks of data.
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Something like:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Something like:
Code: Select all
Do Until RSTO.EOF
Erase strDBRows
strDBRows = RSTO.GetRows(20000)
'I'm guessing once you've used GetRows() the bookmark is moved to the next row, otherwise
'you would need to specify the Start argument: .GetRows(20000,20001) etc. Use a variable for this.
'do something with the 20k rows..
Loop
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.