Code for "Delete & Submit" (Infopath 2003) - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Code for "Delete & Submit" (Infopath 2003)

Last post 08-01-2009 07:13 PM by Winney. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-31-2009 06:37 AM

    • Winney
    • Not Ranked
    • Joined on 07-29-2009
    • Posts 5

    Code for "Delete & Submit" (Infopath 2003)

    I'm currently using Infopath 2003 and I haven't been able to find code for this action.

    I'm using JScript and have tried:

    XDocument.QueryAdapter.Command = "delete dbo.Table where valueId = 5; ";
    XDocument.Query();

    I've also tried a Stored Procedure and it didn't work.  Yet when I used the normal Delete & Submit action, it did work.  So I was hoping to run that action in the Jscript.

     Thanks,

  • 07-31-2009 07:49 AM In reply to

    Re: Code for "Delete & Submit" (Infopath 2003)

     What do you mean by "it didn't work?"  Did you get an error message?  If so, what?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 07-31-2009 02:00 PM In reply to

    • Winney
    • Not Ranked
    • Joined on 07-29-2009
    • Posts 5

    Re: Code for "Delete & Submit" (Infopath 2003)

    No error message, it just wouldn't delete the row in the DB.

    I believe it's because I did not set the user to OWNER.  However, that doesn't make sense, because I was still able to delete with the DELETE & SUBMIT action.

  • 07-31-2009 05:38 PM In reply to

    Re: Code for "Delete & Submit" (Infopath 2003)

     I see.  Yes, I just tried this and got the same results.  It seems this is happening because InfoPath sends the command

    set implicit_transactions on

    before your query.  Then the DELETE is considered an implicit transaction, and InfoPath sends the command:

     IF @@TRANCOUNT > 0 ROLLBACK TRAN

    Which rolls back your command.

    I've found that you can get around this by turning implicit_transactions off, so please try this:

     XDocument.QueryAdapter.Command = "set implicit_transactions off  delete dbo.Table where valueId = 5; ";

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-01-2009 07:13 PM In reply to

    • Winney
    • Not Ranked
    • Joined on 07-29-2009
    • Posts 5

    Re: Code for "Delete & Submit" (Infopath 2003)

     Thanks so much!  This was giving me a lot of headaches!

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.