Submitoperaton failed exception has been thrown by the target of an Invocation

Thread is closed for posting
2 posts, 0 answers
  1. Nelson
    Nelson avatar
    62 posts
    Member since:
    Apr 2011

    Posted 07 Nov 2011 Link to this post

    Hi there,

    In my silverlight application I need to save in database one object of type "ASSUNTOS". However I don´t know way, the application give this error and don´t save.
    Submit Operaton failed exception has been thrown by the target of an Invocation. (in image).

    And here are my code to do that:

      public void DF_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
                this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
                                            Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |
                                            Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Delete |
                                            Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Commit |

                if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
                    if (this.novoItem)
                        bool i;
                        Assuntos assuntos = new Assuntos();
                        assuntos.IdProp = -1;
                        assuntos.ReuniaoIdProp = AppGlobais.Globais.reuniaoGlobal.IdProp;
                        assuntos.DesignacaoProp = AssuntoSeleccionado.DesignacaoProp;
                        assuntos.ConteudoProp = AssuntoSeleccionado.ConteudoProp;
                        assuntos.ConclusoesProp = AssuntoSeleccionado.ConclusoesProp;
                        assuntos.EmVotacaoProp = AssuntoSeleccionado.EmVotacaoProp;
                        assuntos.NumeracaoProp = AssuntoSeleccionado.NumeracaoProp;
                        assuntos.AprovadoProp = 1;
                        assuntos.AprovadoEmProp = DateTime.Now;
                        assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
                        assuntos.ActivoProp = 0;
                        assuntos.ImportadoDocumentoProp = AssuntoSeleccionado.ImportadoDocumentoProp;
                        assuntos.PossuiVotacaoProp = AssuntoSeleccionado.PossuiVotacaoProp;
                        assuntos.TipoassuntoIdProp = AssuntoSeleccionado.TipoassuntosProp.IdProp;
                        assuntos.SugeridoEmProp = AssuntoSeleccionado.SugeridoEmProp;
                        assuntos.SugeridoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;
                        assuntos.SitProp = 1;
                        assuntos.InsDataProp = DateTime.Now;
                        assuntos.InsUserProp = AppGlobais.Globais.Utilizador.LoginProp;
                        assuntos.AltDataProp = null;
                        assuntos.AltUserProp = null;
                        assuntos.VersaoProp = 0;
                        assuntos.PossuiTomadaConhecimentoProp = AssuntoSeleccionado.PossuiTomadaConhecimentoProp;

                        assuntoGuardado = assuntos;

                        if (assuntos.AprovadoProp == 1)

                            assuntos.AprovadoEmProp = DateTime.Now;
                            assuntos.AprovadoPorProp = AppGlobais.Globais.participanteReuniao.IdProp;

                        BloquearLeituraEscritaDados = true;
                       this.novoItem = false;

    And in EditEnded I do the submit:

     public void DF_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
                this.VisibilidadeBotoes = Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Add |
                                             Telerik.Windows.Controls.Data.DataForm.DataFormCommandButtonsVisibility.Edit |

                if (e.EditAction == Telerik.Windows.Controls.Data.DataForm.EditAction.Commit)
                    AppGlobais.Globais.ContextoSGA.SubmitChanges(SubmitCompleted, null);

    Please I need really help here.

    Thanks in advance.

    Nelson Silva
  2. PetarP
    PetarP avatar
    754 posts

    Posted 10 Nov 2011 Link to this post

    Hello Nelson,

     I am afraid that the error is too generic and will not help us in any way determine the cause of the error. It seems that during the commit of your data an error occurs on your server that can be caused by either a concurrency issue or a violation of a constraint. To be able to see the actual error it would be much easier if you put a break point in your call back method for the completed event and there you should be able to see the real error.

    Kind regards,
    the Telerik team

    NEW and UPDATED OpenAccess ORM Resources. Check them out!

Back to Top