Next we use the Select Function with a DateTime. We create a new DataTable storing Widget model information. We populate it with three rows.
Module Module1
Sub Main()
' Create a table.
Dim table As DataTable = New DataTable(
"Widgets")
' Add 2 columns.
table.Columns.Add(New DataColumn(
"ID", GetType(Integer)))
table.Columns.Add(New DataColumn(
"Date", GetType(DateTime)))
' Add rows.
table.Rows.Add(100, New DateTime(2001, 1, 1))
table.Rows.Add(200, New DateTime(2002, 1, 1))
table.Rows.Add(300, New DateTime(2003, 1, 1))
' Get rows more recent than 6/1/2001.
Dim result() As DataRow = table.Select(
"Date > #6/1/2001#")
' Loop.
For Each row As DataRow In result
Console.WriteLine(row(0))
Next
End Sub
End Module
200
300