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

Posted on 2011-04-20
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

    You have to use two separate connections.
    LVL 69

    Accepted Solution

    this is known as MultipleActiveResultSets (MARS).


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now