ASP advanced article online Management Update (III)

Source: Internet
Author: User
Tags insert
Online ASP Advanced article online Management Update--saving article

Author: Beach Boy

After the addition of the article process, I think we would like to know how the ASP code to save the information on the page to the database inside it? And this function must also be implemented by another page, because of the integrity of the ASP to the database, by the ASP to realize the operation of the database is very simple, it is easy to add to the database, update, modify, delete and other operations, and our program just for these aspects have certain requirements, below to introduce the article in this program to save the page!

Create a new ASP file savearticle.asp, below indicate the specific meaning of its main code:

The Insert database connection file
<!--#include file= "conn.asp"-->
"Insert interpretation HTM code file, the next section will be introduced, mainly to the HTM code to convert to avoid the page format confusion, but also more convenient for the publication of technical articles
<!--#include file= "Articlechar.inc"-->
"If you are not entering from the admin page, go to the Authentication Administrator Information page
<%
If Request.Cookies ("Adminok") = "" Then
Response.Redirect "Login.asp"
End If
%>
<%
Dim typename
Dim title
Dim content
Dim sql
Dim rs
Dim ArticleID
Dim typeid
"Accept the content of the article from the addarticle.asp, where the htmlencode2 is the process of converting the HTM code, included in the Articlechar.inc
Title=htmlencode2 (Request.Form ("Txttitle"))
Content=htmlencode2 (Request.Form ("Txtcontent"))
Typeid=request.form ("typeID")
"opens the specified recordset and has Write permission
Set Rs=server.createobject ("Adodb.recordset")
Sql= "SELECT * from article where (ArticleID is null)"
Rs.Open sql,conn,1,3
"adds to the specified recordset, where the AddNew is an object that increases the content of the database, and if there is no AddNew only update then it is updated
Rs.addnew
RS ("title") =title
RS ("content") =content
RS ("typeID") =typeid
RS ("date") =date ()
Rs.update
Articleid=rs ("ArticleID")
"Close open recordsets and database connections
Rs.close
Set rs=noting
Conn.close
Set conn=nothing
%>

<div align= "center" >
<table border= "1" cellspacing= "0" width= "50%" bgcolor= "#F0F8FF" bordercolorlight= "#11B1FF" bordercolordark= "# F0F8FF ">
<tr>
&LT;TD width= "100%" bgcolor= "#0080C0" height= ">"
<p align= "center" ><font color= "#FFFFFF" ><b> add article Success </b></font></td>
</tr>
<tr>
&LT;TD width= "100%" >
<p align= "left" ><br>
"Displays the page after the save succeeds and indicates its article number and title
Its file name is: <%response.write "article" &articleid%><br>
File title: <%response.write title%></p>
<center>
<p align= "center" > Do you want to continue adding? <br>
<br>
<a href= "addarticle.asp" >
Yes </a> <a href= "manage.asp" > No </a><br>
<br>
</p>
</td>
</tr>
</table>
</div>

Okay, our article online add save program to here is done, use it you can do whatever you want online add the article and information, in this section of the HTM code conversion procedures, then in the next section, we will talk about how to achieve the conversion of HTM code!

Reprint please indicate the source http://asky.on.net.cn



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.