Stored Proc Button - InfoPath Dev
in

InfoPath Dev

Stored Proc Button

Last post 09-04-2012 05:49 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-31-2012 07:23 AM

    Stored Proc Button

    I have recently upgraded a working system from Windows XP and Office 2003 to a Windows 7 and office 2007.

    I have two buttons that call stored procedures in SQL “Copyinsert” which is essentially a save as routine and a “Findformula” which will locate a given formula.

     “Findformula” works wonderfully

    “Copyinsert” Does not work

    I can trigger the “Copyinsert” stored proc from other means and it works fine, but I cannot get it to work from Infopath

     

    Button Code:

    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:q="http://schemas.microsoft.com/office/infopath/2003/ado/queryFields" xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-08T14:01:43" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"'); //

    function CopyInsert::OnClick(eventObj)

    {

     var RecipeNew = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Formulas/@FormulaNumber").text;

    var RecipetoCopy = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Formulas/@FormulaNumber").text;

    XDocument.QueryAdapter.Command = "CopyInsert " + "'" + RecipetoCopy + "',"+"'"+RecipeNew+"'";

     XDocument.Query(); }

     

     function FindFormula::OnClick(eventObj)

     {

     var Formula = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Formulas/@FormulaNumber").text;

    XDocument.QueryAdapter.Command = "QueryFormula " + "'" + Formula+"'";

    XDocument.Query(); }

    Please help!!
  • 09-03-2012 08:20 PM In reply to

     IMO, correct me if I am wrong, JScript of Infopath 2003 (that you cited) is not supported in Infopath 2007/2010.

    You should re-write it in C# or VB.NET

     

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 09-04-2012 04:31 AM In reply to

    I’m a newbee here and not in a position to correct anyone, but the Fetchformula stored Proc works with this script in 2007. If what you say is true then I’ll try some VB.

    I would still welcome any suggestions

  • 09-04-2012 05:49 PM In reply to

    Hi - I think in IP 2007 we could still use script. Sorry, I've not got my IP 2007 VM open.

    At any rate, I was going to suggest SQL Analyzer to see what SQL your form is actually sending to the DB....also, you can run your script in debug.

    Hilary Stoupa

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