Solved

ASP.NET - how to have multiple data readers in same routine

Posted on 2007-11-20
1
292 Views
Last Modified: 2008-02-01
I'm working on an ASP.NET/vbscript project and I have 3 sections of data on a form, each with a different datasource declared in the Page_Load. The problem I'm running into is that the first declaration (opening and filling SqlConnection, SqlCommand, SqlDataReader) works fine, but when I try to pull data from the 2nd SqlDataReader, I get an error message saying "Invalid attempt to read when no data is present". The sql command it is using to fill the reader is valid and works just fine. When I remove the code for the first datareader, the second one works perfectly fine....it just seems that when there are two declared and opened in the same routine, the second fails. Is there a way to have multiple datareaders in the same routine (they are named differently)?
0
Comment
Question by:wppiexperts
1 Comment
 
LVL 7

Accepted Solution

by:
nisarkhan earned 50 total points
ID: 20322672
you use the

dr.NextResult();
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

15 Experts available now in Live!

Get 1:1 Help Now