Data Connection using Code - InfoPath Dev
in

InfoPath Dev

Data Connection using Code

Last post 06-05-2007 02:04 PM by aehicks. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-31-2007 08:18 AM

    Data Connection using Code

    Does anyone know how to use VBScript code to invoke a data connection?
  • 06-01-2007 03:38 PM In reply to

    Re: Data Connection using Code

    Hi Aehicks andwelcome to the forum,

    Unfortunately, we don't do any VBScript coding. We recommend .NET, but we could give you some help with JS if you were using that.

     

    Patrick Halstead
    Project Manager at Qdabra
  • 06-01-2007 07:30 PM In reply to

    Re: Data Connection using Code

    Well, in general, using the InfoPath OM is the same in both JScript and VBScript...

    Here is an example of an OnLoad handler which queries a web service (assuming you have added "TestConnection" ws adapter in InfoPath Designer):

    Sub XDocument_OnLoad(eventObj)

                    XDocument.DataAdapters("TestConnection").Query()

    End Sub

    In general, here is a good reference if you need to find out what objects exist and what the parameters are:

    http://msdn2.microsoft.com/en-us/library/bb230145.aspx

    Hope this helps.

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-05-2007 01:19 PM In reply to

    Re: Data Connection using Code

    Thanks for your help.  However, being new to InfoPath, I'm not really sure how to make the OnLoad handler work.  Let me explain more on how I was to use it.  I've written some code to run when the user clicks on the submit button.  On of the final lines of code will call a data connection called "submit".  I wrote the following code: 

    XDocument.DataAdapters("submit").Query()

    When I tested it, I got the following error:  ""Object doesn't support this property or method:  'XDocument.DataAdaters'".  Again, I know nothing about data adapters, so if someone could help me with the correct syntax I would appreciate it.

     

    Thanks.

  • 06-05-2007 01:42 PM In reply to

    Re: Data Connection using Code

    Are you sure you didn't misspell it? You code looks correct but the error says"DataAdaters" with a "p" missing :)

    Also, to submit, you want to call .Submit() and not .Query()

    You can read this for more details: http://msdn2.microsoft.com/en-us/library/bb229877.aspx

    Good luck!

    David Airapetyan / Software Services Architect
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-05-2007 02:04 PM In reply to

    Re: Data Connection using Code

    You were correct.  Once I changed the Query() to Submit() it worked perfectly.  Thanks for your help.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.