Typed DataSet

An XML schema can be used to generate a dataset that is “typed.” Instead of using the index property of a collection to access an element of the dataset, you can use the name of a column. Here is a fragment from the TypedDataSet example:

Dim UAL As AirlineBroker.AirlinesRow = _
   a.FindByName("United")
Console.WriteLine("{0}({1}) ReservationNumber:{2} " & _
   "WebSite:{3}", UAL.Name.Trim(), _
   UAL.Abbreviation.Trim(), _
   UAL.ReservationNumber.Trim(), UAL.WebSite.Trim())

You can assign a meaningful name to rows as well as use strong typing to make sure you are working with the data element you want. If you try to set the field UAL.ReservationNumber to an integer, the compiler will detect the mistake.

A typed DataSet inherits from the ...

Get Application Development Using Visual Basic® and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.