Setup a data connection using code - InfoPath Dev
in

InfoPath Dev

Setup a data connection using code

Last post 08-09-2007 10:01 AM by admot. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-07-2007 09:57 AM

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Setup a data connection using code

    I would like to have a form that has a few data connections to a web service. The form will be available offline as well but there is no need. No need to setup a resource file to reference the pull downs. What I plan on doing is OnLoad, use IsDestinationReachable to see if the webservice can be reached. If it can, then setup the data connection to the web service (Note: This is an actual setup where code is used instead of going into Tools\Data Connections... ). If it cannot establish a connection, pull up a detailed popup indicating some pull downs won't work but you can use them when you get online.

    function XDocument::OnLoad(eventObj)

    {

    if (0==Application.IsDestinationReachable(http:// --web service's website--))

    { XDocument.UI.Alert("The server is unavailable."); }

    else

    { XDocument.UI.Alert("The server is available."); }

    }

     

    Question: Is there a way to code a data connection setup? I performed a search but only could find this thread which didn't provide much information. http://www.infopathdev.com/forums/thread/13100.aspx

    Overall, the goal is to allow the template to open when a data connection is not present w/out using a xml resource. The above is my attempt at this.

    Thanks!

    Don't grow old regretting the things you didn't do.
  • 08-09-2007 10:01 AM In reply to

    • admot
    • Top 500 Contributor
      Male
    • Joined on 08-09-2006
    • USA
    • Posts 51

    Re: Setup a data connection using code

    From what I gather, creating a data connection in IP is the same thing as setting up an asp page.

    Does anyone know the syntax to create a data connection to a web service via an asp page?

     I tried googling the proceedure/sample text but could not find anything specific to a web service. All the ones I found connect to a database.

    Don't grow old regretting the things you didn't do.
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.