Typed DataSets VS. UnTyped DataSets

Strongly Typed Datasets

A Strongly Typed Dataset is a custom class that encompasses classes derived from DataSet, DataTable, and DataRow. This specialized class inherits all the functionality of the base DataSet class and can be seamlessly used with methods that expect an instance of a DataSet class as a parameter. It is designed to establish a strong association with database tables during the design phase, providing comprehensive schema information directly within the code.

Stored within an .xsd file, Strongly Typed Datasets facilitate rigorous schema validation at design time by leveraging the definitions outlined in the .xsd file. This enables error checking and ensures adherence to the specified schema during development. By including the .xsd file within the application, developers gain convenient access to tables and columns using their actual names, simplifying data manipulation and retrieval. Strongly Typed Datasets empower developers to define the desired structure and behavior, even if it deviates from the exact database schema.

With Strongly Typed Datasets, you are in control. You have the flexibility to specify the exact structure and behavior you require, regardless of whether it perfectly matches the underlying database schema. This level of control and customization allows for a more tailored and efficient data access experience, empowering developers to align the dataset structure precisely with their application's needs.

C# Strongly Typed Datasets example      VB.Net Strongly Typed Datasets example typed-dataset

UnTyped DataSets

DataSet ds = new DataSet();

An Untyped DataSet refers to an instance of the System.Data.DataSet class without any predefined schema. Unlike a Strongly Typed Dataset, an Untyped Dataset is not bound to specific tables during design time, and there is no corresponding built-in schema available.

In an Untyped Dataset, the schema is determined dynamically at runtime when the code executes. The dataset is not aware of the specific schema at design time, and as a result, there is no error checking facility available during the design phase.

During runtime, the Untyped Dataset can be populated with data from various sources, and the structure of the dataset is determined based on the retrieved data. This flexibility allows for more dynamic and adaptable data access scenarios.

Since there is no predefined schema, accessing tables and columns within the Untyped Dataset is typically done using generic methods and properties. The lack of a predefined schema means that there is no strict enforcement of the data structure, and it is up to the developer to handle data manipulation and validation appropriately.

C# Dataset Samples      VB.Net Dataset Samples


An Untyped Dataset is a more flexible and dynamic approach to working with data, as it allows for runtime binding of tables and does not have a predefined schema. This provides versatility but also requires careful handling and validation of data during runtime.