running out of memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi;

I have to write custom data integrity utilities comparing files with table
data.
I've found that looping through an ado recordset will cause memory problems
if it's a large recordset.

I'm using this sort of syntax:

adoRSdir = adocn.Execute(sSQL, lrecs)

Do Until adoRSdir.EOF = True
'this loop is running out of memory
Loop

How can you monitor if you're going to run out of memory?
What technique would be better other than narrowing the sql
querystring result set?

Thanks for your knowledge.

Best Regards;

Todd
 
Hi,

First of all it is not ADO, but ADO.NET newsgroup. Maybe you should consider
using of the SQL statements on a server side inside of SP to do this rather
than looping through the records. What do you need to achieve?
 
Hi, take a look at this article it discusses some code optimization
strategies:

http://www.vbip.com/books/1861002610/chapter_2610_07.asp

And if you are using SQL Server you can also limit your query with something
like

SELECT TOP 100 ....

And then change your condition such as greater than the value of the 100th
row for the next query.
Make sure that from iteration to iteration you are closing the recordset and
releasing its memory by setting it to null when the iteration completes.

Alex
 
This suggestion from Stephen Howe worked.

If same machine:
Same thing applies but now you are aware that your SQL request may cause
your database considerable overhead depending on complexity of request. I
would be tempted to do

adoRSdir.Open(SQLRequest,,,,) etc

Thanks for your responses:
 
This suggestion from Stephen Howe worked.

If same machine:
Same thing applies but now you are aware that your SQL request may cause
your database considerable overhead depending on complexity of request. I
would be tempted to do

adoRSdir.Open(SQLRequest,,,,) etc

Thanks for your responses:
 
Back
Top