Let's find out what is Main Data source and what is secondary Data source, How to add a secondary data source, how these data connection are different by each other, and how to retrieve a reference to the Main data source or to an InfoPath secondary data source programatically.
Dear Friends!
If you like this Post Kindly comment below the post and Do share your responses. See more Post of this Blog or Ask me to Write on a Topic.
Introduction to Dataconnection
In Infopath form Dataconnection is used to receive data from a Data Sources.Introduction to data sources
In every Infopath form there are two types of data sources: Main and secondary data source. An InfoPath form template will always contain one Main data source and can contain zero or more secondary data sources.
What is the difference between the Main data souce and secondary data sources
Main data source of a Infopath form contains the data that you want to permanently store when you save the Infopath form. An secondary data source is a temp storage location for data that is external to the Infopath form. This data is placed outside of the form in databases, XML files, SharePoint lists or libraries, or can be retrieved from web services.
If you will save a form, the data in the secondary data sources of the form will never be saved in the form. This is an important fact to remember when you design InfoPath form templates. Thatsmean, if you wanted to store data in a form after you save, close, and re-open the form, you have to store this data in the Main data source of the form.
How to create data sources
A Main data source is automatically added to an form when you create a InfoPath form template. You can create or add a existing secondary data source to InfoPath by adding a Receive or Submit data connection to a form template. You can add an InfoPath data connection to a form template by going to the Tools menu and selecting Data Connections.
How to view data sources
You can use the Data Source task pane to view InfoPath Main and secondary data sources in a form template. If the Data Source task pane is not visible, click Data Source on the View menu to bring it up. The Data Source drop-down list box will contain the text Main for the Main InfoPath data source and an InfoPath data connection name followed by the text (Secondary) for a secondary data source