⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sort_ok.asp

📁 不错的ASP整站源代码。在IIS环境下运行都没有问题
💻 ASP
字号:
<!--#include file="../checkuser.asp" -->
<%
 m_ver = Trim(request("ver"))
 if m_ver="cn" then 
  tmpstr_t="[中文版]"
 elseif  m_ver="en"  then 
 tmpstr_t="[英文版]"
 else
 response.write "错误访问页面,请重试" 
 response.end    
 End If%>
<!--#include file="../../include/db_conn.asp"-->
<%

sort_action=Request.Form("sort_action") 
set myrs=server.createobject("adodb.recordset")
if sort_action="add_new" then 
	''添加新的产品类别
	parentcatalog=cint(Request.Form("parentcatalog")) 
    boardname1=replace(Request.Form("boardname1"),"'","''")    ''取得新目录名
	if parentcatalog=0 then	  
	  sqlstr="select * from ys_product2_catalog where catalogid=parentid and catalogname='"&boardname1&"'"
      myrs.open sqlstr,conn
	  if myrs.eof then
	    sqlstr="insert into ys_product2_catalog(catalogname) values('"&boardname1&"')"
		conn.execute(sqlstr)
		sqlstr="select catalogid from ys_product2_catalog order by catalogid desc"
		rs=conn.execute(sqlstr)
		sqlstr="update ys_product2_catalog set parentid="&rs("catalogid")&" where catalogid="&rs("catalogid")
		conn.execute(sqlstr)
		response.redirect "productcatalog.asp?ver="&m_ver
	  else
	   showError chr(34) & boardname & chr(34) & "目录已经存在!"
	  end if
	else
	  sqlstr="select * from ys_product2_catalog where catalogid<>parentid and  parentid="&parentcatalog&" and  catalogname='"&boardname1&"'"
	  myrs.open sqlstr,conn
	  if myrs.eof then
	    sqlstr="insert into ys_product2_catalog(catalogname,parentid) values('"&boardname1&"',"&parentcatalog&")"
		conn.execute(sqlstr)
		response.redirect "productcatalog.asp?ver="&m_ver
	  else
	   showError chr(34) & boardname & chr(34) & "目录已经存在!"
	  end if
	end if
	response.end 
	  
	  
	  
	if myrs1.eof then
		strSQL = "INSERT ys_product2_Catalog(CatalogName) VALUES('" & boardname & "')"
		conn.Execute strSQL
		strSQL = "Select top 1 CatalogID FROM ys_product2_Catalog order by CatalogID desc"
		adoRS2.open strSQL,conn
		intCatalogID = adoRS2(0)
		adoRS2.close
		if intLastLV = 0 then
			strSQL = "UPDATE ys_product2_Catalog SET ParentID=CatalogID,CatalogLV=1,orderid=0"
			strSQL = strSQL & " WHERE CatalogID=" & intCatalogID
		else
			strSQL = "UPDATE ys_product2_Catalog SET ParentID=" & root_sort & ",CatalogLV=" & intLastLV+1 & ",orderid=0"
			strSQL = strSQL & " WHERE CatalogID=" & intCatalogID
		end if
		conn.Execute strSQL
		adoRS.close
		call closedb
		Response.Redirect "productcatalog.asp"
		
	else
		adoRS.close
	    showError chr(34) & boardname & chr(34) & "目录已经存在!"            
	end if	



elseif sort_action="edit" then 
	''当修改时
	intCatalogID=cint(Request.Form("hidCatalogID")) 
	boardname2=replace(Request.Form("boardname2"),"'","''")    ''取得新目录名
	
	strSQL1 = "select * from ys_product2_catalog where catalogid<>parentid and parentid=(SELECT parentid FROM ys_product2_Catalog WHERE  catalogid="&intCatalogID&") and CatalogName='" & boardname2 & "'"
	strSQL2 = "UPDATE ys_product2_Catalog SET CatalogName='" & boardname2 & "' WHERE CatalogID=" & intCatalogID
	myrs.open strsql1,conn
	if myrs.EOF then
		conn.Execute strSQL2
		myrs.Close
		call closedb
		Response.Redirect "productcatalog.asp?ver="&m_ver
	else
		myrs.close
	    showError chr(34) & boardname & chr(34) & "目录已经存在!"            
	end if
	
	
elseif sort_action="move" then 
	''当移动目录时
	intSource = cint(Request.Form("selCatalogSource")) 
	intTarget = cint(Request.Form("selCatalogTarget")) 
	
	strSQL = "UPDATE t_Catalog SET ParentID=" & intTarget & " WHERE CatalogID=" & intSource
	conn.Execute strSQL
	call closedb
	Response.Redirect "productcatalog.asp"

	  
elseif sort_action="del" then    
    ''当删除时
	intCatalogID=cint(Request.Form("hidCatalogID")) 

	strSQL = "DELETE from ys_product2 WHERE CatalogID=" & intCatalogID
	conn.Execute strSQL
	strSQL = "DELETE from ys_product2_Catalog WHERE CatalogID=" & intCatalogID
	conn.Execute strSQL
	call closedb
	Response.Redirect "productcatalog.asp?ver="&m_ver
else
	Response.Write "参数传输不正确!"
	  
end if
call closedb
%>
<%sub showError(msg)%>
<script language="javascript">
  alert('<%=msg%>');
  location.href="productcatalog.asp?ver=<%=m_ver%>";
</script>
<%end sub%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -