1. | What data object is used in the ADO.NET disconnected model? |
|
2. | In what situation is it best to use a DataSet object? |
|
3. | In what situation is it best to use a DataReader object? |
|
4. | What object with the connected model is used to return XML data? |
|
Answers
1. | The DataSet object is used in ADO.NET to return data to an in-memory local cache representation of the data from the data source. The client is then disconnected and will only reconnect when updates need to be passed back to the data source. |
2. | A DataSet object is appropriate in situations where data is coming from multiple tables and/or multiple data sources. It is useful for populating data-bound controls and when there is a need to cache data for sorting or filtering. It can also be used to pass structured data through Web services. |
3. | A DataReader object is appropriate in situations where data does not need to be cached locally. If data just needs to be provided quickly, one time, and in a read-only and forward-only fashion, then a DataReader can be very efficient. |
4. | Like the DataReader, the XmlReader provides a read-only, forward-only view of the data. But in the case of the XmlReader, the data is in an XML format. |