Problem with stored procedures and InfoPath 2007 - InfoPath Dev
in

InfoPath Dev

Problem with stored procedures and InfoPath 2007

Last post 04-27-2009 01:28 PM by ghporras. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 04-27-2009 05:25 AM

    Problem with stored procedures and InfoPath 2007

    Hello...

    I'm trying to work with a stored procedure (from SQl 2005) in my Infopath 2007.

    I found this Microsoft article: http://msdn.microsoft.com/en-us/kb/kb00827007.aspx but I have problems with this simple code:

    XDocument.QueryAdapter.Command = "execute mysp 'This is a test' ";
    XDocument.Query();

    First I received that the XDocument doesnt exits in the actual context.

    After search in Google I found as solution to add the reference: Microsoft.Office.Interop.InfoPath.SemiTrust.

        using Microsoft.Office.InfoPath;
        using Microsoft.Office.Interop.InfoPath.SemiTrust;  <<< NEW LINE
        using System;
        using System.Windows.Forms;
        using System.Xml;
        using System.Xml.XPath;
        using mshtml;

    But when added this dll I get another error. InfoPath is not getting XDocument.QueryAdapter as a Static object and it needs a reference. Also that XDocument.QueryAdapter doen't have a definition for 'Command'.

    Can someone help me what it's going on with the Microsoft example? Or maybe if you can tell me another page with a parameterized stored procedures and InfoPath 2007.

    Thanks a lot of.

     

  • 04-27-2009 05:52 AM In reply to

    Re: Problem with stored procedures and InfoPath 2007

    Hi

    you should add namespace using System.Data.SqlClient;

    Replace  below line XDocument.QueryAdapter.Command with below lline

    string
    text1 = "This is a test";

    XDocument.QueryAdapter.Command  = string.Format("execute dbo.mysp '" + text1 + "' ");

     

    dbo.mysp is the name of you sproc and text1 is the value of the parameter that needs to be passed to execute the sproc.

    Madhuri
    http://www.ggktech.com
  • 04-27-2009 11:45 AM In reply to

    Re: Problem with stored procedures and InfoPath 2007

    Hello Madhuri...

    I still have the same problem.. The Error is about a reference 'Microsoft.Office.Interop.InfoPath.SemiTrust._XDocument2.QueryAdapter.get'.

    Also that the 'object' has no definitions for 'Command'.

     

    This is my code:

    using Microsoft.Office.InfoPath;

    using Microsoft.Office.Interop.InfoPath.SemiTrust;

    using System;

    using System.Windows.Forms;

    using System.Xml;

    using System.Xml.XPath;

    using System.Data;

    using System.Data.SqlClient;

    using mshtml;

     

    public partial class FormCode

    {

    public void InternalStartup()

    {

    ((
    ButtonEvent)EventManager.ControlEvents["CTRL3_5"]).Clicked += new ClickedEventHandler(CTRL3_5_Clicked);

    }

    public void CTRL3_5_Clicked(object sender, ClickedEventArgs e)

    {

    XDocument.QueryAdapter.Command = "execute mySp '20090401' ";XDocument.Query();

    }

     

  • 04-27-2009 11:53 AM In reply to

    Re: Problem with stored procedures and InfoPath 2007

    I dont know if its important, but you must know that the SQL Server is other server... Its different from my machine.

    An in my machine I have the InfoPath form!

     

  • 04-27-2009 01:28 PM In reply to

    Re: Problem with stored procedures and InfoPath 2007

    I have found something more:

    I cannot access the XDocument members.

    After a . (dot) in XDocument the intellisense show only two methods: Equals and ReferenceEquals.

    My InfoPath is in Spanish.

    Someone can help me?

     

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