Function of the last article in Asp.net

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.