Link to home
Start Free TrialLog in
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

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

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
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?
ok, you might be onto something there: let me go back & look..

Thanks,
Rich
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...
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.
understood, thanks
R
ASKER CERTIFIED SOLUTION
Avatar of Butler Bros
Butler Bros
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial