Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 25th, 2010, 11:09 AM
Registered User
 
Join Date: Jan 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default sqlDatareader

listing 8 in aspnet 2 0 professional is trying to execute two data readers simultaniuosly and I assume that if the outhors did it ,it should work.

the program starts with reading registers of one table using OrdersReader = Command.ExecuteReader()
and then for each record it reads (with the same connection) anothe table using OrderDetailReader = Command.ExecuteReader()
with out closing the first one.
when the program come to execute the second datareader I get the error message about having to close the first one.


Dim DBCon As SqlConnection
Dim OrdersReader As SqlDataReader


Dim OrderDetailReader As SqlDataReader
Command.Connection = DBCon
OrderDetailReader = Command.ExecuteReader()
 
Old January 26th, 2010, 03:06 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

I remember getting an error similar to this. I got around the problem with something like this...

if (databaseConnection) {
// we still have the connection - good to go
} else {
// code to create a new connection
}

I was able to get three queries going, and I think that's the code that did it. If not let me know, and I'll check the code.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inheriting SqlDataReader and new KeyWord software_developer_kk C# 2 June 28th, 2007 08:17 AM
SqlDataReader testsubject ADO.NET 9 March 7th, 2006 06:08 PM
looping through columns in sqldatareader rlull ASP.NET 1.0 and 1.1 Basics 1 November 5th, 2005 02:32 AM
Urgent getting Error while using SqlDataReader hums ADO.NET 2 September 29th, 2004 10:03 AM
SelectedValue property using SqlDataReader shiju ADO.NET 0 September 28th, 2003 03:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.