ASP Advanced Tutorial Ⅳ: Add a wonderful message

Source: Internet
Author: User
When one day you in your guest book message record to see a very wonderful message, in order to introduce to your netizens, you will consider these messages with a separate page display, so that more Internet users more easily see it? If this is true as I said, then you will get what you want as long as you have read the contents of this chapter.
To add "wonderful message" function to the guest book, the same can be achieved by three steps.
Step one: First, create a new data table (such as perfect) in the message database that is dedicated to storing wonderful messages.
Because the structure of the datasheet used to store the message is the same as the structure of the data table that holds the message, the simplest way to create a perfect datasheet is to copy the guestbook structure of the message datasheet, and then paste and confirm it. The following figure:

Step two: Write the "Add the wonderful Message" Message processing program (wonderful.asp).
<!--#include file= "Adovbs.inc"-->
<!--#include file= "post.asp"-->
<% id = request.querystring ("ID")%>
<%
Set conn = Server.CreateObject ("ADODB. Connection ")
DBPath = Server.MapPath ("Book2.mdb")
Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & DBPath
sql = "DELETE * from perfect WHERE (id =" & Request.QueryString ("id") & ")" Set RS = conn. Execute (SQL)
sql= INSERT INTO perfect select * from guestbook where (id = "& Request.QueryString (" id ") &") "
Set RS = conn. Execute (SQL)
%>
' In order to avoid when we are in the process of "adding a wonderful message", a continuous comment on a message repeated the operation caused by the error, we can ignore it 3,721, first perfect datasheet in general id = "& Request.QueryString (" id ") & "Message records deleted, and then the message datasheet Guestbook id =" & Request.QueryString ("id") & "message inserted into the datasheet perfect.
Step Three: Design message is added to the excellent message data sheet after the page (post.asp).
Related Article

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.