-
The following code retrieves the item from the second row and fourth column of the data table.
myString = myDatatable.Rows(1)(3).ToString()
-
The following code deletes the third column of the data table.
Columns.RemoveAt(2)
-
The following code checks if data table has a column named "Total" and returns true/false.
doesContain = myDatatable.Columns.Contains("Total")
-
The following code returns the index of the column named "Total".
myIndex = myDatatable.Columns.IndexOf("Total")
-
The following code returns array of DataRows with all rows where the value of column "Last name" is equal to "Mayer".
drSelection = dt.Select("Lastname = 'Mayer'")
-
The following code returns an array, ordered in ascending order on the Age column, of DataRows with all rows where the value of column "Last name" is equal to "Mayer".
drOrderedSelection = dt.Select("Lastname = 'Mayer'", "Age ASC")
-
The following code combines all values of a given DataRow to a string, values are separated by " | ".
myRowString = String.Join(" | ", row.ItemArray.Select(Function(p) p.ToString()))