Base solution for your next web application
Open Closed

Create new sub-unit on organization generates SQL error #8936


User avatar
0
darutter0508 created

I am using the .net core with jquery 8.3.0. I have extended the OrganizationUnit to include an integer column and was able to create a root node to the structure. However, when I attempt to add a sub-unit (child of the root) I get the following SQL exception:

INFO 2020-04-27 11:32:10,384 [15 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'Sapphire.Web.Areas.Sapphire.Controllers.OrganizationUnitsController.CreateModal (Sapphire.Web.Mvc)' ERROR 2020-04-27 11:32:12,620 [15 ] nostics.DeveloperExceptionPageMiddleware - An unhandled exception has occurred while executing the request. System.InvalidOperationException: The connection does not support MultipleActiveResultSets. at Microsoft.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)

This is happening in the save process. It performs the InsertAsync() without an error but later in the process it throws this error. Please let me know how to resolve this.


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Can you share some code?

    Does the application throw an exception only when instert OrganizationUnit?

  • User Avatar
    0
    darutter0508 created

    This is the out of the box _CreateModal.js file. It appears to be failing when it executes this javascript. The CreateOrganizationUnit method of the OrganizationUnitAppService never gets hit.

    (function() { app.modals.CreateOrganizationUnitModal = function () {

        var _modalManager;
        var _organizationUnitService = abp.services.app.organizationUnit;
        var _$form = null;
    
        this.init = function(modalManager) {
            _modalManager = modalManager;
    
            _$form = _modalManager.getModal().find('form[name=OrganizationUnitForm]');
            _$form.validate({ ignore: "" });
        };
    
        this.save = function() {
            if (!_$form.valid()) {
                return;
            }
    
            var organizationUnit = _$form.serializeFormToObject();
    
            _modalManager.setBusy(true);
            _organizationUnitService.createOrganizationUnit(
                organizationUnit
            ).done(function(result) {
                abp.notify.info(app.localize('SavedSuccessfully'));
                _modalManager.setResult(result);
                _modalManager.close();
            }).always(function() {
                _modalManager.setBusy(false);
            });
        };
    };
    

    })();

  • User Avatar
    0
    darutter0508 created

    As I mentioned, adding a root node works, but the child nodes fail.

  • User Avatar
    0
    darutter0508 created

    Found the issue.