Im having problems with my ms acess sql command, well im trying to get the last value from the database

here is my code, the error is ORDER BY clause syntax error..


record.SelectCommand = New OleDbCommand("SELECT PatientID FROM PatientRecord ORDER BY PatientID desc LIMIT 1", data)

Dim ds As New DataSet

Dim dr As DataRow


dr = ds.Tables(0).Rows(0)

TextBox1.Text = dr(0)

Or is there any alternative to get the last row from the database? Thank you all

Since it is ms access that you are using, you could use

SELECT LAST(columnname) FROM tablename


SELECT MAX(columnname) FROM tablename