When I was doing my website yesterday, I was expected to be finished in the morning. You can have a rest in the afternoon. But the plan has not changed fast. Add the bossArticleBrowsing function.
I thought it would be easy to get it done in a moment.
Two SQL statements are written: Select top 1 * from news where ID> @ ID, select top 1 * from news where ID <@ ID.
I did not think about it (Note: When querying a table, it is in ascending order by default, and a record with no value may be found. There is no previous or next one. This is determined on the page. Otherwise, there will be an instance error that does not reference the object to the object.), And then go to the front-end. Click the previous article. Click the next article to jump to the first article.
No debugging, that is, several response. Write (Id. tostring () are used ()). Tested the value of ID. .... Alas, that would be lost. It's not until this morning.
Conclusion: The idea of doing things is unclear. The problem is not complicated. If you do not need to analyze it. You can think of it. WriteCodeBe careful. I found that I spent a lot of time debugging some errors that were not due to this. Due to your own carelessness. It appears repeatedly. Make corrections later.
Functions of the previous article:
Write two SQL statements to get the first and second articles of an article:SelectTop 1*FromTable where ID <ID of the current articleOrder by id desc;SelectTop 1*FromTable where ID>ID of the current articleOrder by id asc;
These two SQL statements are used. On the page, I use linkbutton to display the previous and next links.
That's it.