Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The HostFileDataAdapter.Fill method fills a DataSet object with table columns and rows from a data source; though constraints are commonly set by the data source, the Fill method does not add this schema information to the DataSet object by default. To populate a DataSet object with existing primary key constraint information from a data source, you can call HostFileDataAdapter.FillSchema.
Note
If a column in a data source is identified as auto-incrementing, the FillSchema method, or the Fill method with a MissingSchemaAction of AddWithKey, creates a DataColumn that has an AutoIncrement property set to true. However, you must set the AutoIncrementStep and AutoIncrementSeed values yourself.
To populate a dataset with additional key constraints
Call
HostFileDataAdapter.FillSchema, using the targetedDataSetand Schema that contains the specified key constraints.Adding schema information to a
DataSetbefore filling it with data ensures that primary key constraints are included with theDataTableobjects in theDataSetobject. As a result, when additional calls to fill theDataSetare made, the primary key column information is used to match new rows from the data source with current rows in eachDataTableobject, and current data in the tables is overwritten with data from the data source. Without the schema information, the new rows from the data source are appended to theDataSetobject, resulting in duplicate rows.
See Also
Working with the Host File Adapter and Dataset
BizTalk Adapter for Host Files Configuration