I am trying to skip the first 5 rows then fetch the next 5, i'm using this for a page system. However something is wrong with my command. I rarely use databases because I get lazy and I hope somebody can help me with this.
I've tried putting the brackets around the columns i'm selecting in case any were protected and I tried adding offset 5 rows to the end of the statement.
strSQL = "SELECT [ID], [AuthorName], [AuthorID], [Title], [Content], [Views], [Replies], [LatestTime] FROM [Threads] ORDER BY [ID] DESC offset 5 rows";
When I run this code I get an error page with the message:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
and obviously the error is where the command is executing.
I figured this out thanks to user https://stackoverflow.com/users/3401554/ben, what I did is not the most efficient it but it works for forums. I did my page number * the amount of threads per page, then I got the top records from the DB and skipped all the records in the reader till I reached the last 10.
User contributions licensed under CC BY-SA 3.0