Avatar of Butler Bros
Butler BrosFlag for United States of America

asked on 

Why do I get: "There is already an open datareader associated with this command which must be closed first"

I'm getting: "There is already an open datareader associated with this command which must be closed first"

Hi, I've got  a TabControl, with several TabPages, with RadGridViews in them.

I pretty much let the GUI do most of the wiring up of the grids & data..

Everything seems to be working except, I'm getting the Subject's message when I Add a new Row.

As soon as the row is added, I get the icon on the row, and that message.(I'm testing by using the  "ItemNumberChanges" tab)

The row adds just fine, and I can update it, & delete it as well.

The Add  function(by using the built-in "Click here to add a new row" fires off:


    Private Sub RadGridView_ItemNumberChanges_UserAddedRow(sender As Object, e As Telerik.WinControls.UI.GridViewRowEventArgs) Handles RadGridView_ItemNumberChanges.UserAddedRow
        Cribcrawl_Item_No_ChangesTableAdapter.Update(Me.ReportServerDataSet_Item_No_Changes)
    End Sub

Open in new window


From there, it goes to the:  ReportServerDataSet_Item_No_Changes.vb, and to:


       
Public Overloads Overridable Function Update(ByVal dataSet As ReportServerDataSet_Item_No_Changes) As Integer
            Return Me.Adapter.Update(dataSet, "cribcrawl_Item_No_Changes")
        End Function

Open in new window

.NET ProgrammingMicrosoft SQL Server

Avatar of undefined
Last Comment
Butler Bros
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Add "MultipleActiveResultSets=True" to your connection string. Have a look at https://www.emoreau.com/Entries/Articles/2006/11/MARS-and-Asynchronous-ADONet.aspx
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

ASKER

Hi Eric, I had poked that into my App.Config, with no help earlier today...
I wonder if I've got another connection string that I'm not aware of...


Rich
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

That is the only thing you need to add. But are you sure that your config file is used? Have you connected some controls (like adapters) directly to your database?
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

ASKER

ok, you might be onto something there: let me go back & look..

Thanks,
Rich
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

ASKER

I did find another connection string in: settings.designer.vb
I poked the  string in there as well, and the error once I add a record changed to:
"concurrency violation : Updated 0 of the expected 1 records"


I'll see what I can find...
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

I never use the adapters and/or design time controls that connect to database. It is either Entity Framework and dataset fully created in code. So I can't help on your specific case.
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

ASKER

understood, thanks
R
ASKER CERTIFIED SOLUTION
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo