June 2002
Intermediate to advanced
864 pages
18h 35m
English
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 ...Read now
Unlock full access