About data connections

Microsoft Office InfoPath 2003

Show All Show All

About data connections

A data connection establishes a dynamic link between a form and an external data source, such as a Web service or database, that allows users to view and work with data from that data source. In particular, a data connection can be used to populate the choices in a list box; receive data from a database, Web service, Microsoft Windows SharePoint Services site, or XML document; submit data to a database, Web service, or Microsoft Windows SharePoint Services form library; or submit a form as an attachment in an e-mail message.

There are two types of data connections: those that receive data from an external data source and those that submit data externally. These two types of data connections function slightly differently based on whether they are primary data connections, which are established when the form is first designed, or secondary data connections, which are added after the form is designed.

Note  When you design a form based on a database, the resulting primary data connection can both submit and receive data.

Primary and secondary data connections

You can create a primary data connection by designing a form that is based on a database or Web service. The main data source for the form is then defined by the structure and properties of the database or Web service. If you add a data connection that receives data to an existing form, however, the data connection results in a secondary data source, whose fields and groups contain the data that's received.

A secondary data source can be used in many of the same ways as a primary data source. However, with a secondary data source users cannot save the data they enter into the form to use offline. In addition, form designers cannot specify default values or custom, noncode-based data validation for a secondary data source.

Because any data source that is associated with a data connection must match the structure of the external data source, the following limitations apply to both primary and secondary data sources:

  • The data source can not be created automatically by inserting controls into the form.
  • The structure and properties of existing fields or groups in the data source cannot be modified. In primary data connections, however, you can add fields or groups to the root group in the data source.

Data connections that receive data (secondary data sources)

When you add a data connection to a form that receives data, Microsoft Office InfoPath 2003 creates a secondary data source for the form that matches the structure of the external data source. This external data source can include databases, Web services, Windows SharePoint Services form libraries and lists, and XML documents.

You can work with the form's secondary data source in the same way that you work with the form's primary data source. For example, you can create controls based on the secondary data source, and then apply conditional formatting to the controls. Depending on the options you specify when creating the data connection, the data from the data connection can be retrieved either automatically when the form is opened or when the user requests it.

Data connections that submit data

Unlike primary data connections or secondary data connections that receive data, data connections that submit data do not affect the form's data sources. Instead, they establish a connection between the form's existing data sources and an external data source, which enables the form's data to be submitted to a database, Web service, or a Windows SharePoint Services form library. You can also create a data connection that will submit your form as an attachment in an e-mail message.

In most cases, you will submit the entire form when using a submit data connection. In the case of Web services, however, you can choose to submit specific parts of the form. You can also define how you want the data to be submitted to the Web service— for example, whether you want to include the entire field, including tags, or just the contents of the field, or whether you want to send the data as a string to preserve white spaces.

Note  The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more