Show All

# About ADO.NET dataset integration

You can easily connect forms to Web services that receive data from and submit data to ADO.NET datasets.

Connecting forms to Web services to receive data

To design a form that connects to a Web service so it can receive data from an ADO.NET dataset:

1. In the Design a Form task pane, click New from Data Connection.
2. In the Data Connection Wizard, click Web service as the type of data connection.
3. Select Receive data.
4. Enter the location of the Web service to connect to.
5. Select a Web method that the Web service provides for receiving data.
6. Enter a name or accept the default name for the data connection to be used for receiving data.
7. Click Finish.

Connecting forms to Web services to receive and submit data

Configuring the Web service

To design a form that connects to a Web service so it can receive data from and submit data to an ADO.NET dataset, first configure a Web service to receive data as described previously in steps 1 through 6 under Connecting forms to Web services to receive data, except select Receive and submit data in step 3. To configure a Web service to submit data:

1. Enter the location of the Web service to connect to.
2. Select a Web method that the Web service provides for submitting data.
3. Specify the fields and groups in the form that will provide the data for any parameters of the submit operation. The dataset group to submit is usually the immediate parent of the (choice) group.
4. Enter a name or accept the default name for the data connection to be used for submitting data.
5. Click Finish.

Submitting data

Datasets are serialized using DiffGrams before they are transported over the wire. DiffGrams contain the schema and data of the dataset, and any information regarding changes that have been made to the original copy of the data. When submitting data, Web services use DiffGrams to update the data source with any changes.

When a user edits data, the integrity of the data is maintained according to the following rules. For more information, refer to the documentation for data tables and data columns in the .NET Framework SDK.

- Relationships

  Primary/foreign key relationships between tables in the dataset will be enforced, where all foreign keys must point to an existing primary key.

- Constraints

  Unique constraints are enforced on primary keys and columns that are marked as unique.

- Read-only columns

  Read-only fields that represent columns in the dataset cannot be modified.

- Automatically incremented columns

  Values of fields that represent table columns for which values are to be automatically incremented will be incremented as specified in the ADO.NET dataset.

Connecting forms to Web services to submit data

To design a form that connects to a Web service so it can submit data to an ADO.NET dataset:

1. In the Design a Form task pane, click New from Data Connection.
2. In the Data Connection Wizard, click Web service as the type of data connection.
3. Select Submit data.
4. Enter the location of the Web service to connect to.
5. Select a Web method that the Web service provides for submitting data.
6. Enter a name to identify the data connection for submitting data.
7. Click Finish.

Note the following when setting up a new form that only submits a dataset:

- The dataset must be typed.
- All data submitted is inserted as new data in the DiffGram.
- All data fields in the dataFields subtree are submitted as XML by default.
- You can change the data connection for a submit operation to submit only a specific dataset node through the Data Connections dialog box.

There are a few limitations on datasets:

- Only one dataset is allowed when a form is edited.
- Copying and pasting of nested datasets updates the foreign key to point to the parent values.
- DeleteRule and UpdateRule properties are not supported.
- Constraints or relationships cannot be disabled.

©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