Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

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

$
0
0

I have read a lot on this and I still don't see the error.

MARS is enabled.

The error is being thrown on an Invoke on a view component which previously was working fine.

  public IViewComponentResult Invoke(int id)
        {
            var mproductKitset = from p in  _context.ProductKitset
                       .Include(p=>p.Product)
                       .Where(p => p.ProductKitsetNameID == id )
                       select p;

            ViewBag.ptotal = mproductKitset.Sum(p => p.Product.CostPrice * p.Quantity);

            return View(mproductKitset);
        }

Error is highlighting ViewBag.ptotal

I am sorry, I am not understanding why this is being thrown, and why it started suddenly after working fine previously?


Viewing all articles
Browse latest Browse all 9386

Trending Articles