asp

位置:IT落伍者 >> asp >> 浏览文章

asp调用二级分类代码


发布日期:2022年12月11日
 
asp调用二级分类代码

<%
dim conn
dim connstr
dim db
db="/data/duasp"
Set conn = ServerCreateObject("ADODBConnection")
connstr="Provider=MicrosoftJetOLEDB;Data Source=" & ServerMapPath(db)
connOpen connstr

sub closedatabase()
connclose
set conn=Nothing
End sub
%>
<title>错误提示</title>
<meta httpequiv="ContentType" content="text/html; charset=gb">
<%
dim founderrerrmsg
founderr=false
errmsg=""

if Requestform("MM_insert") then

if requestform("action")="newp" then
sql="select * from p_class_small"
set rs=servercreateobject("adodbrecordset")
rsopen sqlconn
rsaddnew
dim p_small_typep_type
p_small_type=trim(replace(requestform("p_small_type")""""))
p_type=trim(replace(requestform("p_type")""""))
p_small_type_e=trim(replace(requestform("p_small_type_e")""""))
if p_small_type="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称名称!"
else
rs("p_small_type")=p_small_type
End if
if p_type="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须选择一级分类!"
else
rs("p_type")=p_type
End if
由P_type得到p_type_e
sql_p="select p_type_e from p_class where p_type="&p_type&""
set rs_p=servercreateobject("adodbrecordset")
rs_popen sql_pconn
if Not(rs_pBOF and rs_pEOF) then
p_type_e=rs_p("p_type_e")
end if
rs_pclose
set rs_p=nothing
rs("p_type_e")=p_type_e
rs("p_small_type_e")=p_small_type_e
if Not founderr then
rsupdate
rsclose
set rs=Nothing
closedatabase
responseredirect "admin_p_smallasp"
else
Call diserror()
responseEnd
End if
End if

if requestform("action")="editp" then
if requestForm("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if Not isInteger(requestform("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的id参数"
End if
End if
if founderr then
Call diserror()
responseEnd
End if
sql="select * from p_class_small where p_small_id="&cint(requestForm("id"))
set rs=servercreateobject("adodbrecordset")
rsopen sqlconn
p_old_small_type=rs("p_small_type")
p_old_small_type_e=rs("p_small_type_e")
p_small_type=trim(replace(requestform("p_small_type")""""))
p_type=trim(replace(requestform("p_type")""""))
p_small_type_e=trim(replace(requestform("p_small_type_e")""""))
p_type_e=trim(replace(requestform("p_type_e")""""))
if p_small_type="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须输入栏目名称!"
else
rs("p_small_type")=p_small_type
End if
if p_type="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须选择一级分类!"
else
rs("p_type")=p_type
End if
由P_type得到p_type_e
sql_p="select p_type_e from p_class where p_type="&p_type&""
set rs_p=servercreateobject("adodbrecordset")
rs_popen sql_pconn
if Not(rs_pBOF and rs_pEOF) then
p_type_e=rs_p("p_type_e")
end if
rs_pclose
set rs_p=nothing
rs("p_type_e")=p_type_e
rs("p_small_type_e")=p_small_type_e

if Not founderr then
rsupdate
rsclose
set rs=Nothing
连代更新属于此小类的信息
v_sql="select * from p_info where p_small_type="&p_old_small_type&""
set v_rs=servercreateobject("adodbrecordset")
v_rsopen v_sqlconn
if Not(v_rsBOF or v_rsEOF) then
do while not v_rseof
v_rs("p_small_type")=p_small_type
v_rs("p_small_type_e")=p_small_type_e
v_rsupdate
v_rsmovenext
loop
End if
v_rsclose
set v_rs=Nothing
responseredirect "admin_p_smallasp"
else
Call diserror()
responseEnd
End if
End if

if requestform("action")="delp" then
if requestForm("id")="" then
founderr=true
errmsg=errmsg+"<br>"+"<li>你必须指定操作的对象!"
else
if Not isInteger(requestform("id")) then
founderr=true
errmsg=errmsg+"<br>"+"<li>非法的id参数"
End if
End if
if founderr then
Call diserror()
responseEnd
End if
sql="select * from p_class_small where p_small_id="&cint(requestForm("id"))
set rs=servercreateobject("adodbrecordset")
rsopen sqlconn
if Not(rsBOF or rsEOF) then
rsdelete
End if
rsclose
set rs=Nothing
连代删除属于此分类的信息
v_sql="select * from p_info where p_small_type="&p_small_type&""
set v_rs=servercreateobject("adodbrecordset")
v_rsopen v_sqlconn
if Not(v_rsBOF or v_rsEOF) then
do while not v_rseof
v_rsdelete
v_rsmovenext
loop
End if
v_rsclose
set v_rs=Nothing
closedatabase
responseredirect "admin_p_smallasp"
End if
End if

Call p_small_body()
closedatabase
%>

上一篇:asp添加数据代码

下一篇:解决ASP网站gb2312和utf-8乱码问题