473,503 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

There is already an open DataReader associated with this Command which must be closed

1 New Member
I am using visual studio 2012 with SqlServer 2008.
while developing a website, i used datareader
when i wanted to use the datareader again for reading another table data from the same database, i get the error"There is already an open DataReader associated with this Command which must be closed first".
I have used datareader.Close(), it does not help;
I have used datareade.Dispose(), this also does not help;
I have also used using( Datareader ----) it was no help;
I have also used try ( --- ) catch (SqlException)
still i get the same error,
Can any one help. I am stuck because i need to read data a number of times in this web site.
any kind of help or alternative to read data from same database multilpe times will be appreciated.
May 7 '13 #1
3 1662
Rabbit
12,516 Recognized Expert Moderator MVP
I don't use .Net much so I probably can't answer the question but I know that whoever can answer your question won't be able to because you haven't shown us the code that produces the error.
May 7 '13 #2
vijay6
158 New Member
Hey yogeshraj, datareader.Close() method should work.
May 7 '13 #3
rajeshk
2 New Member
yogeshraj,
You cant perform any operation with datareader result.if you want to perform any action with result then you have to use dataset and fetch result with foreach and perform action..

Thanks & regards,
rajeshk
May 8 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

20
7177
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
10
6086
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
13
3397
by: Bart | last post by:
Hi, i get the error: "There is already an open DataReader associated with this Command which must be closed first" Thanks Bart ----------------------------------------- Imports...
3
13181
by: BLUE | last post by:
I've a TransactionScope in which I select some data and I want to do some queries for each record retrieved with my select. I'm using a DataReader and for each record I do factory.CreateCommand()...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.