Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

Background on the Typed DataSet

So far, I've been talking about the untyped Dataset. You can also instruct Visual Studio .NET to create a typed DataSet for you. You do that by describing the schema in XML or graphically, as shown in Figure 2.

Figure 2Figure 2 A schema for a typed DataSet.

The schema is used for generating a class in your project with help from the XSD utility. (That is done automatically for you in Visual Studio .NET.) The generated class inherits from DataSet and somewhat encapsulates the untyped DataSet.


I use the phrase "somewhat encapsulates" for how the typed DataSet hides information about the untyped DataSet because you can always access the untyped DataSet instead. That is because the typed DataSet inherits an untyped DataSet. In my opinion, this is a major weakness.

When you are using a typed DataSet, the schema of the DataSet is known at design time, so many of the tools in Visual Studio .NET can be used to increase productivity (for example, when you create the user interface). You also benefit by working with the DataSet in a type-safe manner when you write your code. Sure, you might still get runtime-type exceptions if your typed DataSet and the database aren't in synch, but many of us really like to have IntelliSense.


The first time I saw IntelliSense in VB, my reaction was to ask where I could disable it. But I quickly got accustomed to using it, and I'm now very sure that it increases my productivity a lot. The most irritating thing about IntelliSense is that it doesn't work everywhere, such as in Notepad.

All readers, in a chorus: "Show us some code! Please!"

Okay, I'll do that, but first let's go over a quick summary of pros and cons.

  • + Share This
  • 🔖 Save To Your Account