Data Set Objects

Datasets are objects that you use to temporarily store the data that is used in your application. There are basically two distinct kinds of DataSet objects: typed, and untyped. Untyped DataSets are the standard generic instances of the DataSet class where you manually build up the DataSet definition (schema) by creating DataTable objects (untyped DataTables) and adding them to the Tables collection in the DataSet. You can access untyped DataTable and DataColumn objects through their collection indices. Typed DataSet objects derive their schema from an .xsd file and contain explicitly typed collections (such as a specific CustomersTable object).

There are three distinct ways to create DataSet objects in Visual Studio:

■ Declare a new DataSet object programmatically in the code editor, which results in an empty DataSet that requires creating DataTable and optional DataRelation objects to be added to the DataSet.

■ Use design-time tools such as the DataSet Designer and the Data Source Configuration Wizard which assists in the creation of typed DataSet objects by stepping you through the process of selecting or creating a data connection and then allowing you to select database objects available from that connection to build up a typed DataSet and have most, if not all, of the necessary code generated for you.

■ Drag a DataSet object from the Toolbox onto a form and use the Table and Column Collection editors to build up the schema of your DataSet.

This lesson describes how to create DataSet objects using each of these methods. NOTE Generating DataSet objects

You can also create DataSet objects based on configured DataAdapter objects. This will be covered in Lesson 3, "Creating DataAdapter Objects," of this chapter.

Was this article helpful?

0 0

Post a comment