ASP call Level two classification code

Source: Internet
Author: User

ASP call Level two classification code
<%
Dim conn
Dim connstr
Dim db
Db= ". /data/1du.asp "
Set conn = Server.CreateObject ("ADODB. Connection ")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath (DB)
Conn. Open ConnStr

Sub CloseDatabase ()
Conn.close
Set conn=nothing
End Sub
%>


<title> Error Tips </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<%
Dim founderr,errmsg
Founderr=false
Errmsg= ""

If Request.Form ("Mm_insert") Then

If Request.Form ("action") = "NEWP" Then
Sql= "SELECT * from P_class_small"
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open sql,conn,1,3
Rs.addnew
Dim P_small_type,p_type
P_small_type=trim (replace (Request.Form ("P_small_type"), "'", ""))
P_type=trim (replace (Request.Form ("P_type"), "'", ""))
P_small_type_e=trim (replace (Request.Form ("P_small_type_e"), "'", ""))
If p_small_type= "" Then
Founderr=true
errmsg=errmsg+ "<br>" <li> you must enter the name of the column name! "
Else
RS ("P_small_type") =p_small_type
End If
If p_type= "" Then
Founderr=true
errmsg=errmsg+ "<br>" + "<li> you must choose the First class category!" "
Else
RS ("P_type") =p_type
End If
' By P_type get p_type_e
sql_p= "Select P_type_e from P_class where p_type= '" "&p_type&" "
Set Rs_p=server.createobject ("Adodb.recordset")
Rs_p.open sql_p,conn,1,1
If not (RS_P.BOF and rs_p.eof) then
P_type_e=rs_p ("P_type_e")
End If
Rs_p.close
Set rs_p=nothing
RS ("P_type_e") =p_type_e
RS ("P_small_type_e") =p_small_type_e
If not Founderr then
Rs.update
Rs.close
Set rs=nothing
CloseDatabase
Response.Redirect "Admin_p_small.asp"
Else
Call Diserror ()
Response. End
End If
End If

If Request.Form ("action") = "EDITP" Then
If request. Form ("id") = "" Then
Founderr=true
errmsg=errmsg+ "<br> +" <li> You must specify the object of the operation! "
Else
If not Isinteger (Request.Form ("id")) Then
Founderr=true
errmsg=errmsg+ "<br> +" <li> illegal ID parameter. "
End If
End If
If Founderr Then
Call Diserror ()
Response. End
End If
Sql= "SELECT * from P_class_small where p_small_id=" &cint (Request. Form ("id")
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open sql,conn,1,3
P_old_small_type=rs ("P_small_type")
P_old_small_type_e=rs ("P_small_type_e")
P_small_type=trim (replace (Request.Form ("P_small_type"), "'", ""))
P_type=trim (replace (Request.Form ("P_type"), "'", ""))
P_small_type_e=trim (replace (Request.Form ("P_small_type_e"), "'", ""))
P_type_e=trim (replace (Request.Form ("P_type_e"), "'", ""))
If p_small_type= "" Then
Founderr=true
errmsg=errmsg+ "<br>" <li> you must enter the column name! "
Else
RS ("P_small_type") =p_small_type
End If
If p_type= "" Then
Founderr=true
errmsg=errmsg+ "<br>" + "<li> you must choose the First class category!" "
Else
RS ("P_type") =p_type
End If
' By P_type get p_type_e
sql_p= "Select P_type_e from P_class where p_type= '" "&p_type&" "
Set Rs_p=server.createobject ("Adodb.recordset")
Rs_p.open sql_p,conn,1,1
If not (RS_P.BOF and rs_p.eof) then
P_type_e=rs_p ("P_type_e")
End If
Rs_p.close
Set rs_p=nothing
RS ("P_type_e") =p_type_e
RS ("P_small_type_e") =p_small_type_e

If not Founderr then
Rs.update
Rs.close
Set rs=nothing
' To update the information that belongs to this small class
V_sql= "SELECT * from P_info where p_small_type= '" &p_old_small_type& ""
Set V_rs=server.createobject ("Adodb.recordset")
V_rs.open v_sql,conn,1,3
If not (v_rs. BOF or V_rs. EOF) Then
Do as not v_rs.eof
V_rs ("P_small_type") =p_small_type
V_rs ("P_small_type_e") =p_small_type_e
V_rs.update
V_rs.movenext
Loop
End If
V_rs.close
Set v_rs=nothing
Response.Redirect "Admin_p_small.asp"
Else
Call Diserror ()
Response. End
End If
End If

If Request.Form ("action") = "Delp" Then
If request. Form ("id") = "" Then
Founderr=true
errmsg=errmsg+ "<br> +" <li> You must specify the object of the operation! "
Else
If not Isinteger (Request.Form ("id")) Then
Founderr=true
errmsg=errmsg+ "<br> +" <li> illegal ID parameter. "
End If
End If
If Founderr Then
Call Diserror ()
Response. End
End If
Sql= "SELECT * from P_class_small where p_small_id=" &cint (Request. Form ("id")
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open sql,conn,1,3
If not (Rs. BOF or Rs. EOF) Then
Rs.delete
End If
Rs.close
Set rs=nothing
' To delete information belonging to this category
V_sql= "SELECT * from P_info where p_small_type= '" &p_small_type& ""
Set V_rs=server.createobject ("Adodb.recordset")
V_rs.open v_sql,conn,1,3
If not (v_rs. BOF or V_rs. EOF) Then
Do as not v_rs.eof
V_rs.delete
V_rs.movenext
Loop
End If
V_rs.close
Set v_rs=nothing
CloseDatabase
Response.Redirect "Admin_p_small.asp"
End If
End If

Call P_small_body ()
CloseDatabase
%>

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.