<%
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
' is P_type 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
& nbsp; 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
The
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
& nbsp 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
' is P_type 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
Update of information belonging to this small class
V_sql= select * from P_info whe Re 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 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
The
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
& nbsp 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
Hyphen 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
don't 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
%>