15.4 Refreshing Data After Updating

The DeleteCommand , InsertCommand , and UpdateCommand objects submit the changes made to a DataSet back to a data source. This is however a one-way process; the updated data isn't automatically returned back to the DataSet . Often this is acceptable because after the update, the data in the data source implicitly matches the data in the DataSet . This isn't, however, the case for some data such as AutoIncrement columns when rows are inserted into the data source and timestamp columns, which are updated with a new value whenever the row is updated in the data source. In both cases, a new value must be retrieved from the data source row when it's inserted, or in the case of the timestamp column, updated or inserted.

The UpdatedRowSource property of each Command object that submits updates to the data source determines how data is returned back to the DataSet . By default, this property is set to Both , resulting in both the data in the first returned row and the return values for stored procedures updating the DataSet after the update. The property can be set so that only the first returned record or only the return parameters update the DataSet , or so that the DataSet isn't updated.



ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net