Solved

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

Posted on 2007-11-20
1
295 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pagebreak issue while printing the aspx page 3 24
Delete HTML table rows 12 27
Need help with building query string 2 19
encoding an href string 2 20
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

816 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

10 Experts available now in Live!

Get 1:1 Help Now