The data source control failed to execute the insert command

While working on a custom form the other day, we noticed the form that was working fine was suddenly throwing the following error:
“The data source control failed to execute the insert command”

Without anything to go off of we started comparing version history in the form, comparing source control versions, searching online, nothing really worked. It ended up being a combination of several things.

First, make sure your XSLT databinding parameter matches the type of databinding you’re doing. For example, there are three types of databinding parameters available in the SharePoint:FormField control:
i = Insert Used for NewForm pages
u = Update Used for EditForm pages
d = Delete Self-explanatory

Therefore, if you’re adding a FormField control to a NewForm page, you wouldn’t want to use the ‘u’ parameter in the ddwrt:DataBind() function, it should be as follows:

Likewise, your EditForm page would look like this:

In addition to this, the other issue was there were site columns that were deleted but still being referenced in the form template. Either locating those site columns in the template and commenting them out or removing them altogether, or re-adding them to the site columns page solved the problem.

Another possibility I found was after applying an update (or through changes from troubleshooting) you may find the SPDataSource for the form’s DFWP is changed to:

The DataSourceMode is supposed to be:

There could be other reasons for this error, feel free to add them to the comments below. Hope this helps!

Short URL:

Eric Oszakiewski

Eric Oszakiewski is a professional software developer based in Scottsdale, AZ with over 36 years of IT experience, and 19 years Native American Gaming experience. He is currently working as a Sr .Net/SharePoint Development Lead for General Motors, and also as a consultant.

More Posts

Follow Me:
TwitterFacebookLinkedInGoogle PlusYouTube

3 thoughts on “The data source control failed to execute the insert command”

  1. Thank you very much, it was the Page separators. When I move Survey into Designer, it makes the page Separators void. So I removed them in the form but not in the code. Once they were removed from the code, it worked perfectly. Thanks!

  2. I got the same error:

    If you have diplayed any custom columns or lookup columns or calculated columns in edit/new forms you must have manually entered its sharepoint control tag.
    In that tag change the to ControlMode=”Display” from ControlMode=”Edit”/ControlMode=”New”

    Hope it helps

Leave a Reply