Solved

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

Posted on 2007-11-20
1
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

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

dr.NextResult();
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…

735 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