How Do You Use Two Data Readers At Same Time Within VB .NET 2010

Posted on 2011-04-20
Medium Priority
Last Modified: 2012-05-11
I was wondering if it was possible to run two data readers that would access the same database at the same time. (The purpose is to save memory depending of if certain logic is required in order to call tthe second data reader. The purpose is to limit how much data is loaded into RAM memory on a server.) These two data readers would be attached to the same database and would be accessing two different tables that are within the same database. Would this be possible, number one? Is there a better way to use data readers to pull from another table to make a more complex query after the data has been called from the inital data reader to limit the amount of memory being used due to the results set that would be returned from the query that is passed to each of the data readers, with the second one being dependent on whether or not a block of code would be called or not.
Question by:thenthorn1010
LVL 83

Expert Comment

ID: 35433044
You have to use two separate connections.
LVL 70

Accepted Solution

Éric Moreau earned 2000 total points
ID: 35433199
this is known as MultipleActiveResultSets (MARS).

check http://www.emoreau.com/Entries/Articles/2006/11/MARS-and-Asynchronous-ADONet.aspx

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question