check this article
How to populate DataGridView, GridView with SQL statement in C#[
^]
to get the last row of a table, I found I could do it like this: -
select * from articles order by artid desc limit 1;
It basically lists all the rows in decreasing artid order, and only select the first 1 (which is the last row in the table as it's reversed). To get the second from last: -
select * from articles order by artid desc limit 1,1;
when limit is given two params, it uses the first number as an offset, and the second number as the number of rows to get. If you wanted you could get all last 8 rows by saying .....limit 0,8.