Show All

# dataObject Element

Defines a secondary data object that is used in a Microsoft Office InfoPath 2003 form.

## Type

    xsd:complexType

## Structure

Name | Description
--- | ---
initOnLoad | (Optional attribute) Specifies whether the data object should be initialized on document load.
name | (Required attribute) The unique name for the data object.
schema | (Optional attribute) The name of an XML Schema file.
query | (Required element) Associates the data adapter with the data object or a form's underlying XML document.

## Remarks

The dataObject element is an optional element of the dataObjects element.

Multiple dataObject elements are allowed within a form. Each data object is an XML Document Object Model (DOM) populated from an external data source that can be accessed directly (by name) from the XSL Transformation (XSLT)–based view code and any script-based business logic code in the form.

## Example

The following is an example of the dataObject element:

    <xsf:dataObjects>
       <xsf:dataObject
          name="EmployeeNames"
          schema="EmployeeNames.xsd"
          initOnLoad="yes">
          <xsf:query>
             <xsf:adoAdapter
                connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
                   Password=&quot;&quot;;User ID=Admin;
                   Data Source=infnwind.mdb;Mode=Share Deny None;
                   Extended Properties=&quot;&quot;;..."
                commandText="select [EmployeeID],[LastName],[FirstName]
                   from [Employees] as [Employees]"
                queryAllowed="yes"
                submitAllowed="yes">
          </xsf:adoAdapter>
    			</xsf:query>
    		</xsf:dataObject>
    	</xsf:dataObjects>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp