Solution - There is already an open DataReader associated with this Command which must be closed first.

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


Problem : 

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

Cause :
Having more than 1 dataReader result set working at the same time .

Solution : 

In my solution example, i work with SqlServer2000 and VB.Net 2005 
The Example Project can be downloaded at the end of this post :
It contains (SqlServer2000 DataBase - VB.Net Project)
The example shows how to navigate (First Record - Next Record) using ADO.Net 2.0 Online-Mode using SqlClient DataReader ...
Sql Database Name : Market
Sql Database Table : Market.Info
Server Name : evry1falls
(in order to see the example correctly, you'll have to Import the Database 'Market' into your sqlserver2000 Enterprise Manager)
Photo1 : Application Final Design
VB.net SqlServer project
VB.net SqlServer project

Photo2 : Table Structure
vb.net sqlserver datagridview


vb.net sqlserver table
Photo3 : Codes
vb.net sqlserver source code
vb.net sqlserver source code
Photo4 : Codes
vb.net sqlserver source code


vb.net sqlserver source code
Photo5 : Codes
vb.net sqlserver source code
vb.net sqlserver source code
Now if you run the project and tried to navigate using (First) or (Next) you will get the Exception :
There is already an open DataReader .....
so the solution would be :

Trap the Exception that shows in the (SelectedIndexChanged) Event of the (ComboBox) like this :


and the same for the (Next) Button ..
now you can Navigate and search using combobox safely without exceptions ..

Note :
- Source code will give you exception and you will have to re-write the solution by yourself  as shown above .
- The Folder(Bin/Debug) Includes (Back-Up) use it to restore the (Market Database) in your sqlserver2000
- use the namespace (evry1falls) as new server Registration .

Download Source Code : MediaFire Link


Using MS Access 2003/2007/2010

- In case of using Microsoft Access Database, OleDb.OleDbDataReader with OleDb.OleDbCommand.


The work around or the solution would be :
Always create a new Instance of the OleDbCommand, I.e

vb.net

OOP Toturial Index Polymorphism VB 2010 VB 2010 Optimization object oriented programming vb.net vb.net OOP Crystal Report Freelance Optimization VB 2010 MS-Access 2003/2007 ADO.Net visual basic course Crystal report and VB .net Earn money programming - Programmer Jobs Online Online courses VB2010 Receive E-mail Search Optimization Sql Server Visual Basic Visual Basic 2010 online courses Visual Basic Job online visual basic courses pop server pop3 visual basic courses online visual basic online courses ADO.Net online mode Insert Date into SqlServer using VB.Net Install Crystal report No error message available SqlServer VB 2010 DataGridView Visual Basic .Net and SQL Server Date-Time Visual Basic .net Visual Basic Class connecting to access database via dao using vb.net. database e-mail .net framework 4.5.2 Activate Visual Studio 2005 Advantage Data Dictionary Advantage Database Visual Basic 2010 Binary Diff Buttons sound in VB 2010 CR for VS2015 CRforVS2015 Check internet connection Command Prompt Communicate with a client Compare two applications Compare two strings and return differences Compare two treeviews Conversion from type 'DBNull' to type 'String' is not valid Crystal Report with Protected MS-Access database DAO + VB .NET + ACCESS DataGridView VB 2010 Programming DataGridView with MS-Access DataReader DevExpress 12.2.9 Serial crack full DevExpress VB.Net DevExpress full Download DevExpress 12 Dxperience 12.2.4 Dxperience full serial crack Event Planning Example on connecting to Advantage Data Dictionary from VB.Net FC Command Fade Image VB 2010 MS Access 2010 MS SQL SERVER 2000 INSTALLATION MS VB.Net MS-Access 2007 2010 MS-Access Compact and Repair from VB 2010 Programmatically Make sure application is running Microsoft Visual Basic .Net Math Functions list OOP Lesson 11 OOP Lesson 12 OOP Lesson 6 OOP Lesson 7 OOP Lesson 8 OOP Lesson 9 OOP Lesson13 OOPTutorials POP3 Commands in VB 2010 Point of sale application Purchase Receive E-mail from Gmail in VB 2010 Requirement Doc Reverse Strings SQL Server 2000 SQL Server 2000 date-time type Sales and Stores application Source code download Sql Server and VB.Net The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine The following control could not be licensed There is already an open DataReader associated with this Command which must be closed first Toolbox items Topmost - Inputbox Sloved Tx TxtControl for Visual Basic Use case definition VB 2005 Activation Code VB 2010 Compare and return differences VB 2010 Create Controls at Run-Time with events VB 2010 How to fade Image VB 2010 Internet VB 2010 Read Text Files VB 2010 Reverse Strings VB 2010 check for internet connection VB 2010 database compact and repair VB 2010 progressbar VB.Net Math functions VB.Net Search Optimization VB.net SqlServer 2000 VB.net lessons VB2010 VS 2051 VS2010 VS2015 VS2017 VS2019 Virus W32.Sality Visual Basic Application Development Visual Basic Virus Visual Studio Serial Number book classes vb compare windows applications and return the difference. crystalDecision older version download crystal report for VB 2010 dtSearch dtSearch Engine dtSearch Engine download full free free make sure application is installed object oriented programming languages oop Lesson 10 play sounds in Visual Basic.net progress bar result code: DB_SEC_E_AUTH_FAILED(0x80040E4D). sqlserver2000 vb.net project (new-save-edit-delete) the application failed to initialize properly 0xc000007b tutorials vb .Net functions list. vb 2010 Create TextBox with events at Project Runtime vb 2010 receive Emails visual basic .Net FlexGrid visual basic courses win10 32 bit solution برنامج المشتريات و المبيعات و المخازن
Show more