Probably using
ADO.NET[
^]. An Object Implementing
IDbCommand[
^] can take your query. In case of Access the
OleDbCommand[
^].
Dim cmd As New OleDbCommand("SELECT MAX(MyColumn) FROM MyTable", connection)
Dim maxValue As Integer = cmd.ExecuteScalar
In case you're using an ORM like LINQ to XML or Entity Framework LINQ would do the trick.
Dim i As Integer = context.MyTable.Max(Function(o) o.MyValue)
Hope it helps :)