Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Receiving error: Exception has been thrown by the target of an invocation.

                                    I get this error when I use a Stored Procedure to perform an insert from the dataset (which is attached to ObjectDataSource and then to your ASPxWebGrid). The Grid fails with this error the first time I click Update. The second time I click Update it works with no error.

                                    Again, this does not work on the first click, but does on the second click of the Update link.

                                    Steps to Reproduce:

                                    Create Dataset from SQL Table

                                    Change the Insert Method to a stored procedure

                                    Stored Procedure Script looks like this:

                                    -----------START---------------

                                    ALTER PROCEDURE [dbo].[INSERT_NEW_CH_CONTAINER_pr]

                                         @CONTAINERID AS VARCHAR(50),

                                         @SITEID AS VARCHAR(15),

                                        @LINER_TYPE AS VARCHAR(50),

                                         @CONTAINER_TYPE AS VARCHAR(50),

                                         @WASTE_MAT_PARAMS AS VARCHAR(50),

                                         @WWIS_STATUS AS VARCHAR(50),

                                         @CONTAINER_STATUS AS VARCHAR(50),

                                         @CONTAINER_STATUS_DATE AS DATETIME

                                    AS

                                    BEGIN

                                         SET NOCOUNT ON;     

                                         INSERT

                                          INTO CONTAINER.DBO.CONTAINERS (     CONTAINERID,SITEID,LINER_TYPE,CONTAINER_TYPE,

                                                                                       WASTE_MAT_PARAMS,WWIS_STATUS,CONTAINER_STATUS,CONTAINER_STATUS_DATE,

                                                                                      RECLASTUPDATEUSER,RECLASTUPDATE,RHCH)

                                         VALUES (     @CONTAINERID,@SITEID,@LINER_TYPE,@CONTAINER_TYPE,

                                                                                      @WASTE_MAT_PARAMS,@WWIS_STATUS,@CONTAINER_STATUS,@CONTAINER_STATUS_DATE,

                                                                                      system_user,GETDATE(),'CH')

                                              BEGIN

                                                   IF NOT EXISTS(SELECT CONTAINERID FROM CH_AK_MASTER WHERE CONTAINERID = @CONTAINERID)

                                                        BEGIN

                                                             INSERT

                                                              INTO CONTAINER.DBO.CH_AK_MASTER     (      CONTAINERID)

                                                             VALUES                                        (     @CONTAINERID)     

                                                        END

                                              END

                                              

                                    END

                                    -------------END-----------------

                                    Actual Results:

                                    Exception has been thrown by the target of an invocation.

                                    Expected Results:

                                    Insert record successfully the first time.

                                0

                                Hello Ray,

                                Thank you for your report. We need additional information to determine what's wrong and to fix the problem.

                                1. Please capture the exception stack trace and send it to us. To catch the exception, the following options must be set:
                                1) In the Tools | Options... dialog, go to the Debugging node and uncheck the Enable Just My Code (Managed Only) checkbox.
                                2) In the Debug | Exceptions... dialog, check the Thrown checkbox for Common Language Runtime Exceptions.

                                2. Send source code of your web page with the ASPxGridView (~.aspx and ~.vb files) and source code of your data object (~.vb).

                                Thanks,
                                Nick

                                0

                                Your steps to enabled the debugging features helped discover the true problem. Our Foreign Key contraints were setup incorrectly from within MS SQL. Thank you for your quick response.

                                0

                                Thank you for your quick response!

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners