I really need some help. I have Datagrid with SQLite, I want to make pagination with all the data that loads in this datagrid from sqlite. I did all what I want to do, except "LastPage". I want to be loaded not all table, only the lasts rows that are <= 50. Maybe someone can help me with that? Here is my code:
int rowstart = 0;
int rowlimit = 50;
private void RefreshGridView()
{
dataGridView1.DataSource = DAL.Select("SELECT * FROM Sales LIMIT " rowstart "," rowlimit "");
}
private void btnLast_Click(object sender, EventArgs e)
{
//HERE I NEED HELP - How to do ?
}
Many hours spend to find a answer ... but I didn't figured it out.
CodePudding user response:
What about
var firstRowOfLastPage = (numberOfRows / rowsPerPage) * rowsPerPage;
var numRowsOnLastPage = numberOfRows - firstRowOfLastPage;