O'Reilly logo

Application Development Using Visual Basic® and .NET by Dana L. Wyatt, Peter Thorsteinson, Robert J. Oberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required