CJ

The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

Error – Custom EditForm.aspx with EventHandler

Posted by Clayton James on August 27, 2008

I have been pulling my hair out for the last couple of hours trying everything possible. Thankfully came across this hotfix.

Scenario

  • Creat a custom edit form in SharePoint designer
  • Create an event handler for ItemUpdating in Visual Studio and bind it to the list that has the custom edit form
  • Whenever you try to update a list item you receive the following error message
    “The data source control failed to execute the update command”

 “This hotfix fixes the following issue that was not previously documented in a Microsoft Knowledge Base article:

You design a project that contains a Windows SharePoint Service 3.0 list. The list uses a custom list form. Additionally, you design the project to display an error message when an ItemUpdating event is triggered. However, when you update an item in the list, the custom error message is not displayed. Instead, you receive the following error message from Windows SharePoint Service 3.0:

The data source control failed to execute the update command”

I haven’t applied it yet but it is exactly my problem.
http://support.microsoft.com/kb/949749

UPDATE: 12/Sep/2008
This hotfix has fixed my problem. I am very happy 🙂

Advertisements

9 Responses to “Error – Custom EditForm.aspx with EventHandler”

  1. Andrew said

    Did you apply this hotfix with success? I am running into the same issue but have not applied the hotfix.

  2. CJ said

    Hi Andrew

    Applied the hotfix and all is good.
    cheers

  3. Helene said

    Hi Andrew,

    I discovered that I get the ‘failed to execute update command’ only when I turn versioning ON on the list, is this your case? ie, does your list have the versioning setting turned ON?

    Thanks,
    Helene

  4. Bindu said

    Hi,

    i applied the fix and it screwed up my system. I am not able to access any of the sites in the server. It says

    Cannot connect to the configuration database.

    and I dont know how to fix this. i tried doing all help i could get in the microsoft site to overcome this but no luck. Please could anyone let me knwo what I should be doing to reset the system

    Regards,
    Bindu

  5. Nayana said

    Hi,

    I had the same issue, afer installing the fix, it only changed the error thatwas coming 😦
    Now the Error is :
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Please help me if anyone has any idea…

    Exception Details: System.Runtime.InteropServices.COMException: ERROR

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [COMException (0x81020089): ERROR]
    Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +0
    Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +199

    [SPException: ERROR]
    Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex) +160
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +63
    Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit() +457
    Microsoft.SharePoint.WebPartPages.DataFormWebPart.PerformCommit() +53
    Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e) +36
    Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) +1060
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
    System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

    ——————————————————————————–
    Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

  6. CJ said

    @Bindu
    Very strange. I am not sure how this hotfix would bring down your environment. Was there anything else that you did trying to fix this issue that has caused this error?
    This seems to be a common error.
    http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=1&ct=result&cd=1&q=cannot+connect+to+configuration+database+wss+3.0&spell=1
    http://dwnz.spaces.live.com/blog/cns!BCC0973FC7B19D91!627.entry

    @Nayana
    I am not sure what the problem is here. Looks like it is failing on an internal SharePoint code.

    Did you both have exactly the same issue that I described above?

    cheers
    CJ

  7. Atul said

    cant open d site coz of hotpix…

  8. yudy said

    if your version is sp1 updating your moss 2007 to sp2 will solve the issue

  9. senglory said

    Doesn’t work at all for me (SPPS 2010)…
    My code:

    if (errorCondition)
    {
    properties.Status = SPEventReceiverStatus.CancelWithError ;
    properties.ErrorMessage = “My error text!”;
    properties.Cancel = true;
    }

    Still getting page with this COMException and my “My error text!” added there. But I the error page ONLY with my text.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: