July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Tables from databases are represented within DataSets via DataTable objects. You can create custom tables in code using a special extension method named CopyToDataTable, which can convert from EnumerableRowCollection (Of T) into a new DataTable. Imagine you want to create a subset of orders from the Orders table and that you want to create a new table with this subset of information. The following code accomplishes this:
Dim query = (From ord In NwindDataSet.Orders Where String.IsNullOrEmpty(ord.ShipCountry) = False Select ord).CopyToDataTablequery.TableName = "FilteredOrders"NwindDataSet.Tables.Add(query)
The query retrieves only the orders where the ShipCountry ...