Using ADO.NET DataSets to Access Forms2RecordDataSet Data

Applies to: SharePoint Workspace 2010 | Visual Studio 2008

It is easy to convert from the Forms2RecordDataSet to a .NET DataSet in the .NET development environment by doing the following:

  • Creating a new DataSet.

  • Populating the DataSet Schema by calling DataSet.ReadXMLSchema using the Forms2RecordDataSet.Schema element.

  • Setting date-time mode for universal time for date-time columns (optional).

  • Populating the DataSet Data XML nodes by calling DataSet.ReadXML using the Forms2RecordDataSet.Data element.

If the Forms2RecordDataSet.Schema element defines more than one record schema, the .NET DataSet will contain one DataTable for each record schema. It also contains additional tables if a field in a schema has a FileAttachments type. The following table describes the DataTables in a DataSet.

Kind of Table

Table Name

Comments

Data records

Record schema name

Each data table contains one row for each record in the Data element that belongs to the form associated with the record schema name. This name is an XML-safe string created from the Form ID. For example, "_454_463363869417099472E_43085" could be a record schema name. The ReadForms operation returns the record schema name in the FormsRecordDataSet_ID element.

File Attachment Metadata

FileAttachment

This table contains a row for each attachment in all records in the Data element. Each row contains the metadata about the attachment, such as name, creation and modification information, and size. If the Forms2RecordDataSet contained attachment contents, then each row has a child row in the Contents table.

Attachment contents

Contents

This table contains a single column named Base64 that contains the byte stream contents of the attachment. Although the contents are passed using Base64 encoding, the .NET proxy code converts the Base64 to a byte stream.

Relationships

Name of attachment field

These tables are used to create a relationship between the rows in the record data tables and the rows in the FileAttachment and Contents table.

To display a .NET DataSet in a DataGrid, you can use the following code:

dataGrid1.DataSource = adoDs;

For a sample of setting the DataGrid styles, see the SetGridTableStyles function in the CSharpGrooveFormsExplorer sample.

Note that ADO .NET DataSets have many capabilities that exceed the data that you can store in a Forms2RecordDataSet. As one example, ADO.NET DataSets can store updates in Diffgrams to be applied to the original data. These Diffgrams are used when using a DataSet to update data in a relational database. You cannot convert a DataSet with Diffgrams into a valid Forms2RecordDataSet. You must apply the Diffgrams by calling the DataSet AcceptChanges operation. When the DataSet accepts the changes, it updates the data in the tables and removes the Diffgrams.

If you have converted a Forms2RecordDataSet to an ADO.NET DataSet and are adding a row to the FileAttachment table, you must specify values for all the columns in the table before adding the row to the table.

In This Section

Converting Forms2RecordDataSet to ADO.NET DataSet Example

Reading Data Records in an ADO.NET DataSet Example

Accessing Attachments in an ADO.NET DataSet Example

Converting ADO.NET DataSet to Forms2RecordDataSet Example

See Also

Concepts

Accessing Forms Tool Records

Accessing the Forms2RecordDataSet Data Using XMLDocument

Querying Records