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

DataSet Fundamentals

You can also fetch a subset of the data in the DataSet. The Select method on a DataTable uses the same syntax as a SQL statement where clause. Column names are used to access the data for a particular row. This example comes for the HotelBroker class, where it is used to get the hotels for a particular city.

 Public Function GetHotels(ByVal city As String) _ As ArrayList Implements IHotelInfo.GetHotels ... Dim t As DataTable = hotelsDataset.Tables("Hotels") Dim rows() As DataRow = t.Select( _ "City = '" & city & "'") Dim hl As HotelListItem Dim hotels As New ArrayList() Dim i As Integer For i = 0 To rows.Length - 1 hl.HotelName = rows(i)("HotelName").ToString().Trim() hl.City = rows(i)("City").ToString().Trim() hl.NumberRooms ...

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