dataset question - to preserve DB resources

C

Chris

I have a procedure which runs a heavy SQL query, loops through a SQLreader
and closes the reader and connection.

Within the loop, there is a lot of code/processing that must remain. I'd
like to open the DB connection, move the data to a dataSet or something to
get the data in memory, and then immediately close the DB reader/connection
to free up DB resources. Then I can loop through the dataSet and perform
all the necessary work, without holding up the database for other users.

My question, using ASP.NET 1.1, can someone provide an example of this
approach?

Thanks in advance.
 
M

Marina

Don't bother with the SqlDataReader. Get the data straight into the dataset
(or datatable) using the SqlDataAdapter's Fill method, then do your
processing.
 
C

Chris

That helped a lot.. Thanks.
My profiler trace shows 7 second queries were reduced to 1 second. Not bad.
Used a DataTable.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top