How to Get data connection data in my button click event ? - InfoPath Dev
in

InfoPath Dev

How to Get data connection data in my button click event ?

Last post 04-12-2010 11:57 PM by denfer06. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-12-2010 05:50 AM

    How to Get data connection data in my button click event ?

    Hello

    I'm using InfoPath 2007 and my code is developped with C#

    My form is connected to a SQL Server where I get list of network Path from an SQL view "qry_InfoPath_NetworkStructure".

    The query return ID & Path columns.

    I have created a drop down list connected to this data source to make sure I can get the value from the server.

    this work fine and I can see and select Path

    Then I have created a button "Create folder" in my form that should create folders using Paths get from the view.

    I have edited the button code event  "public void Btn_CreateFolder_OnClick(DocActionEvent e)"

    and add the below sentence but I didn't get anything :

    IXMLDOMNodeList folderList = thisXDocument.DOM.selectNodes("/dfs:myFields/dfs:dataFields/d:qry_InfoPath_NetworkStructure/@Path");

    Now I stack on how to get these Path list.

    I'm missing something ?

     Any help will be welcomed

    Thanks

     

     

     

  • 04-12-2010 11:57 PM In reply to

    Re: How to Get data connection data in my button click event ?

     I finally get some information on the net and the following link help me a lot:

    http://blogs.msdn.com/timpash/archive/2006/06/12/CSharp-And-Secondary-Datasources.aspx

     below is what I did:

    DOMDocument50 FolderList = (DOMDocument50)thisXDocument.GetDOM("qry_InfoPath_NetworkStructure");

    FolderList.setProperty("SelectionNamespaces", "xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'" + " xmlns:d='http://schemas.microsoft.com/office/infopath/2003/ado/dataFields'");
               
     //Loop on each Network Settings
     foreach (IXMLDOMNode Folder in FolderList.selectNodes("/dfs:myFields/dfs:dataFields/d:qry_InfoPath_NetworkStructure/@Path"))
    {
          if (!Directory.Exists(Folder.text))
               Directory.CreateDirectory(Folder.text);
    }

     

    Hope that will help Infopath beginner like me

     

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