Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Workshop

This workshop will help reinforce the concepts covered in today's lesson.

Quiz

  1. What data access programming model does the DataSet enable?

    The DataSet allows you to build applications that work with data that is entirely disconnected from its data source. It does this by storing the data in an in-memory cache represented as XML and that is serializable for transport across tiers in your application.

  2. Can a single DataSet be populated using both a data adapter and explicit code?

    Yes. Different tables in a DataSet can be populated in different ways. For example, one table could be populated from a data adapter connected to SQL Server, another to a data adapter connected to Oracle, and a third through explicit code that creates new rows manually. This feature is what allows the DataSet to store heterogeneous data.

  3. How do you combine the contents of two DataSet objects?

    You can combine the data in multiple DataSet objects using the Merge method of the DataSet object that will act as the final repository. Keep in mind that errors might result if the schema of the tables differs or if constraints are violated, and that changes in the original DataSet will be overridden by default. If the two DataSet objects contain different tables, they can simply be merged into a single DataSet that contains both tables.

  4. What is the primary use for the DataViewManager?

    The DataViewManager is used to manage the view settings for the collection of tables in a DataSet. Basically, it exposes the sorting and filtering properties of the DataView objects associated with the tables in the DataSet. The DataViewManager can then be associated with a control's DataSource property to enable custom views during data binding.

Exercise

To try out the concepts discussed today, write a method that retrieves the Titles, Categories, and Publishers information from the ComputeBooks database using the usp_GetTitlesLookups stored procedure. After retrieving the data into a DataSet, create a DataViewManager that shows only the titles with a price greater than $25 and sorts the publishers by PubCode.

  • + Share This
  • 🔖 Save To Your Account