isual Basic Express (VB Express) wizards make it easy to connect to a remote data source and start manipulating data. However, the results aren't always flexible enough for a development environment. Most of the time, you are better off foregoing the wizards and building your own objects from scratch using typed datasets. That way, you maintain control and protect the validity of your data.
For example, a wizard won't produce a dataset that can automatically handle a change in source when a user connects to a different database or one that can present a simple, single object interface for the datasetbut you can.
What's a Typed Dataset?
A .NET typed dataset is an in-memory representation of a remote database (e.g., its objects and schema) composed of tables, relationships, constraints, and so on. Its structure can be a bit confusing until you're more familiar with it. Essentially, .NET DataTable objects contain tables and a .NET DataAdapter object fills the dataset. Furthermore, a dataset contains all the objects as a collection.
In a .NET solution, you use datasets to remotely manipulate and modify data. A .NET typed dataset enforces the data type for each column, so that the dataset can be exposed in the interface in a type-safe manner. For example, if a column (at the table level) doesn't allow Null values, the typed dataset will generate an exception if you don't provide a value for that column, whether you use a form, code, or a SQL statement.
In comparison, an untyped dataset doesn't apply strong typing to the columns. You might compare an untyped dataset to an Access Select query that defaults to the default field width, regardless of the column's underlying table property.
Solution Versus Project
Throughout this article, you'll see the terms solution and project. Within the context of .NET, both are containers, but they store different files:
- A solution is a container that stores one or more projects and the files and metadata that define the solution as a whole.
- A project container stores source files and related metadata such as component references and build instructions.
Think of the solution as the big picture and projects as the tasks for creating that picture. A .NET solution can contain a number of projects and you can use projects in more than one solution. That makes .NET more flexible than SQL Server or Access.
By default, a solution supports one project. If you add a second project, VB Express will close the current project in order to create a new one. However, VB Express can handle more than one project in any given solution, but only if you expose the solution file. Otherwise, you're working within the project rather than within the solution.