ASP things function Simple Small application _ Application skills

Source: Internet
Author: User
Conn.begintrans ' Open things function
... The middle is some add modify delete operation
Cancel if there is an error
Conn.rollbacktrans ' Cancel things change and end things
If there's no problem, save it.
Conn.committrans ' Save things and end things
Copy Code code as follows:

<%if not session ("type") = "3" Then
Response. Redirect ". /login.asp "
Else
%>
<!--#include file= ". /conn.asp "-->
<link href= ". /css/home1.css "Type=text/css rel=stylesheet>
<%
Set Rs=server. CreateObject ("Adodb.recordset")
sql = "SELECT * from [Sushe] where m_su= '" & Request. Form ("su") & "'"
Rs.Open sql,conn,1,1
If Rs.recordcount>0 Then
Response.Write ("<p align= ' center ' >" &request.) QueryString ("Name") & ":" & Request. Form ("su") & "is already in storage, please add another" &request. QueryString ("Name") & "! ")
Response. Write "<a href= ' xitong_set.asp ' target= ' mainFrame ' > continue to add </a></p>"
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
Else
Rs.close
Conn.begintrans ' Open things function
Rs.Open "Sushe", conn,1,3
Rs.addnew ' Insert data to the Users table
RS ("M_su") =request. Form ("su")
Rs.update
Rs.close
If Err.number<>0 Then
Conn.begintrans ' Open things function
... The middle is some add modify delete operation
Cancel if there is an error
Conn.rollbacktrans ' Cancel things change and end things
If there's no problem, save it.
Conn.committrans ' Save things and end things
Response. Write ("<p align= ' center ' > add failed, please add" & "" & ")
Response.Write "<a href= ' xitong_set.asp ' target= ' MainFrame ' > re-add </a></p>"
Else
Conn.committrans ' Save things and end things
Response.Write "<script Language=javascript>alert (' Add success! ');"
Response.Write "settimeout (parent.mainframe.document.location= ' xitong_set.asp ', 0)"
Response.Write "</SCRIPT>"
End If
End If
%>

<%end if%>
<%response. End ()%>

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.