No matter what the database backend is and no matter what type of database connection you use, you can still throw SQL commands at it and it will return the data.
Dim value As Integer
Dim con As New OleDbConnection(<connectionstring>)
Dim com As OleDbCommand
Private Sub ReadValue()
com = New OleDbCommand("SELECT MAX(<column>) FROM <table>")
con.Open()
Dim reader As OleDbDataReader = com.ExecuteReader()
If reader.HasRows Then
reader.Read()
value = reader(0)
End If
reader.Close() '<-- Note! Do NOT use con.Close() here.
End Sub
Private Sub AddAndInsert()
value += 1
com = New OleDbCommand("INSERT INTO <table> (<column>) VALUES (" & value & ")")
con.Open()
com.ExecuteNonQuery()
con.Close()
End Sub