submit data to 2 SQL tables - InfoPath Dev
in

InfoPath Dev

submit data to 2 SQL tables

Last post 09-13-2012 08:34 AM by paolo. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-24-2012 05:03 AM

    • paolo
    • Not Ranked
    • Joined on 11-25-2011
    • Posts 20

    submit data to 2 SQL tables

     Hallo,

    my Infopath 2010 form submit data to an SQL server (via a standard  windows data connection).

    I can create a main data connection to one table for data query and submit, that works just fine.

    However, Infopath doesn't allow me to submit to a second SQL data table in the same database

    (or in another database for that matter). It seems the workaround would be to use web services

    interface, but I wondered if there is an alternative options using the ado connection objects from

    .NET available by way of the VB code attached to the form.

    Did anybody try that? What were the results?

     

    Ciao,

    Paolo

     

  • 08-27-2012 03:37 PM In reply to

    Re: submit data to 2 SQL tables

    When you create the main data connection. There is a dialog for adding additional child tables. If you want to submit to two parent tables, you may need to create a Web service. Qdabra provides a free trial of our popular DBXL Web service which can support this scenario if it's the same database. Check out Qdabra.com and click on Web Services for more details.
    Patrick Halstead
    Project Manager at Qdabra
  • 09-13-2012 08:34 AM In reply to

    • paolo
    • Not Ranked
    • Joined on 11-25-2011
    • Posts 20

    Re: submit data to 2 SQL tables

    Well, I'll answer my own post since I found a solution...

    Assume you have SQL Tables named "Apple" and "Banana".

    Make sure Apple has a primary key assigned (say in column Alice).

    This should be the usual way an SQL primary key needs to be ( for instance not allow blanks, be unique etc.)

    Make sure Banana has a column that can contain data of the type of the primary key (say in Column Bob).

    In Infopath create a main data connection to Apple.

    From the data connection window, select "add table".

    That will spawn a window with a list of table relationship.

    There, delete all the relationships, and add a relationship Alice=Bob. Done!

    You can then ignore the column Bob, it just need to be present for Infopath to not get confused.

    Using this strategy I was successful in simultaneous submission of the data to Apple and Banana.

     I have no idea why we need to use such a circuitous route and couldn't just add another connection

    to submit data to directly, but in the end I am happy I can submit to 2 different SQL tables

    without need of additional code with web-services and stuff.


    Ciao,

    Paolo

     

     

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