running out of memory

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
 
V

Val Mazur \(MVP\)

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?
 
A

Alex Passos

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
 
G

Guest

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:
 
G

Guest

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top