Ask a questionAsk a question
 

AnswerData view web part errors

  • Wednesday, April 04, 2007 1:36 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    I am using Data view web part to display my SQL table on my site. I have also enabled the EDIT and DELETE links ..which r meant to Update and Delete records.

    When i do an EDIT, it shows me an error msg " The Data source control failed to execute the Update command "

    Any suggestions ?...

Answers

  • Monday, April 09, 2007 5:54 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I got this one fixed.

     Open  Sharepoint Designer >> Current Data Source

    Right click on each Field names ( row names ) in the right hand side task pane , and Select
    " Insert as text ".

    Do a "Refresh Data Source" then.


All Replies

  • Monday, April 09, 2007 5:54 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    I got this one fixed.

     Open  Sharepoint Designer >> Current Data Source

    Right click on each Field names ( row names ) in the right hand side task pane , and Select
    " Insert as text ".

    Do a "Refresh Data Source" then.


  • Friday, April 20, 2007 10:10 AMSAMSON_1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi neeraj,

     

    I have followed your steps but its still not working.

    Any suggestions ?

     

    Regards

    Samson

  • Friday, April 20, 2007 2:16 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Samson,

    Guess what, i also encountered the same problem again, even though i did select
    " Insert as Text "

    The funny thing is that it works some times, and sometimes even i follow the same procedure as i mentioned in my above thread it doesnt work.

    But this is what i have observed....The Update works successfully, if you do an "Insert as Text" as i have mentioned in my above thread,  provided Primary Key field is not included / listed in the form (from which you are doing an Update/Edit) .

    If you include all other fields, except your PK, then Update shuld work.

    However, this wuz not the case when i first worked on it...i wuz able to update PK also....but now the moment i include PK in my form, it shows me " The update action failed" msg

    I am working on it..will post soon..if i figure out a standardized solution.

  • Monday, April 23, 2007 5:08 PMSAMSON_1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Neeraj,

     

    Thanks for the reply. My table has PK(int), Name(nvarchar), Date(datatetime), Duration(int)datatypes.

    After  primary key is excluded from form

     Im able to insert new records and the same records im able to edit and delete not the ones which are already there in the database.

     

  • Monday, April 23, 2007 5:13 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Samson,

    Did u figure out a way to Update the form with the Primary Key included ?..Is there any solution to tht prb ?

    Neeraj
  • Tuesday, April 24, 2007 10:11 AMSAMSON_1 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Neeraj,

     

    Im having problems excluding the primary key as well... If there are any null fields, Im not able to update. Im trying to figure out and I'll let you know abt it

     

    Samson

  • Thursday, April 26, 2007 1:27 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Samson,...

    Any update from ur side ..regarding doing an Update with the Primary Key included ?

    Neeraj
  • Tuesday, May 01, 2007 4:36 PMipstrategies Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    any new info on this problem? I ahave a simple table 3 fields insert and delete work fine Update gives error:The data source control failed to execute the update command.
  • Tuesday, May 08, 2007 3:15 PMmjh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

     

    I've been wrestling with this problem for awhile.  I tried eliminating the primary key and it still does not work. I still get the "The data source control failed to execute the update command."  message

     

    Microsoft!!! Help!!! We're wasting too much time on these trivial issues.  How about throwing us a bone and telling us what we're doing wrong.  Also, how about some decent error messages to help us.

     

    Mike

  • Wednesday, May 09, 2007 2:44 PMNeeraj Shah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Mike,

     

    I totally agree with u..this is such  a pain in the neck....I myself wasted 3-4 days on this ***...I dunno if Microsoft is goin to do anything abt this.

     

    Well...as for ur problem..did u click on " Insert as Text " option from Sharepoint Designer...it still doesnt work ?

     

     

  • Wednesday, May 09, 2007 3:40 PMipstrategies Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I tried all suggestions and ended up writing an aspx page to update the table and linked to it in  WSS 3.0.  The client was happy with the solution I was not. I am starting to think it is a permissions problem (possibly between Sharepoint Designer and Sharepoint) because I wrote my own update query and tried it in Sharepoint Designer and it did not work (same error) and used that same update query in the aspx page with no problems.
  • Tuesday, April 15, 2008 3:47 PMwuwu Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello,

    are there any solution to this problem.

    I have just now this problem and i work for two days at this?

    I hope somebody can help me!!!!

     

    Thanks,

    Horst

  • Monday, April 27, 2009 6:03 PMWalid Hasan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer

    I had the same problem “The data source control failed to execute the update command”, but after in depth research into the code, I found that the update statement is weird. I modified the update statement, & everything worked just fine after that.

    Here is what you need to do to fix that problem:

    1. Find the UpdateCommand on the page

    You will find a statement that looks like this (UpdateCommand="UPDATE [Table1] SET [Col1] = @Col1, [Col2] = @Col2 WHERE [Col1] = @original_Col1 AND [Col1] = @original_Col1 AND [Col2] = @original_Col2" …

    2. Replace the UpdateCommand with this "UpdateCommand="UPDATE [Table1] SET [Col1] = @Col1, [Col2] = @Col2 WHERE [Col_PrimaryKey Or Col1] = @original_PrimaryKey "

    * Make sure you don't update the Primary Key; you are NOT suppose to update that column. If you do want to update the Primary Key; then, you are better off deleting that row from DB and create new one

    3. After you Save the page, make sure the UpdateCommand you modified is NOT changed back to the original one (step 1).

    It worked for me like a charm, Enjoy :)

     

     

    • Proposed As Answer bygrlynn74 Wednesday, June 10, 2009 2:27 PM
    •  
  • Monday, April 27, 2009 6:21 PMMike Walsh MVPMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    SPD Data View web part questions go to the forum for SPD. -> Design/Customization.

    Moving this
    WSS FAQ sites: WSS 2.0: http://wssv2faq.mindsharp.com WSS 3.0 and MOSS 2007: http://wssv3faq.mindsharp.com
    Total list of WSS 3.0 and MOSS 2007 Books (including foreign language titles) http://wssv3faq.mindsharp.com/Lists/v3%20WSS%20FAQ/V%20Books.aspx
  • Wednesday, June 10, 2009 2:51 PMgrlynn74 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    Walid, it took me a bit of playing with this as it would not allow me to edit the file directly, but the resolution in my case was similar to what you described.

    1. select the data view web part
    2. open data source
    3. click "configure database connection"
    4. make sure authentication setup properly and click next
    5. click "specify custom select, update, insert, and delete commands" and hit finish
    6. click the update tab and hit edit command
    7. delete everything past "WHERE [ID] = @original_ID"

    ** This didn't work for me before applying SP2 for Office 2007.

    MS, fix this already!

    Your dataview web part is NOT WORKING.
    • Proposed As Answer bygrlynn74 Wednesday, June 10, 2009 2:54 PM
    •  
  • Saturday, July 04, 2009 10:13 AMOyester Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I too got the same problem. Finally i figured the problem to be with the update and insert statements.

    For update command i ensured the reference of primary Key columns in the where clause.
    For insert i ensured that all not null columns are included.

    * For delete command even though my command for the dataview webpart is correct i analysed it failed because of a
       foriegn key violation.

    After ensuring the above my dataview webpart works perfect.
  • Thursday, November 05, 2009 6:06 PMWesley Groleau Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Editing the UPDATE and not showing/editing the primary key makes a lot of sense, except...

    In my page, there are embedded INSERT, SELECT, and DELETE, but no UPDATE !