请精通ASP和JSP语言的高手转译一下这段ASP代码,谢谢。
<%'删除ifRequest.QueryString("title")="del"thendimid,sort,name,sqlsort,selectidid=int(R...
<%
'删除
if Request.QueryString("title") = "del" then
dim id,sort,name,sqlsort,selectid
id = int(Request.Form("id"))
sort = int(Request.Form("sort"))
name = trim(Request.form("name"))
BigClassName = trim(Request.QueryString("BigClassName")) '类别
NoncePage = int(Request.QueryString("page")) '当前页码
keytext = Replace(trim(Request("keytext")),"'","") '查询关键字
selectid = Request("selectid")
if selectid = "" or selectid = Empty or selectid = null then
Response.write("<script language='javascript'>alert('请先选择要删除的资料!');window.history.go(-1);</script>")
Response.end
end if
'查询所有勾选资料的图片并用FSO删除
dim rsquery,pic
set rsquery = Server.CreateObject("adodb.recordset")
rsquery.open "select * from ProductSH where id in ("&selectid&")",conn,1,1
if not rsquery.eof then
do while not rsquery.eof
pic = pic & trim(rsquery("pic")) & ","
rsquery.movenext
loop
end if
rsquery.close
dim allstr,i,all
allstr = Split(pic,",",-1) '-1表示返回所有子字符串
For i = LBound(allstr) To UBound(allstr)
delpic("../../pic/"&trim(allstr(i))) 'FSO彻底删除图片,释放空间
Next
sqlsort = "delete from [ProductSH] where id in ("&selectid&")"
conn.Execute(sqlsort)
%>
在线等啊,急!谢谢
请转译成jsp语言,以便我学习。
回 yejunapd,虽然对我没有用,但还是谢谢你。
回 michaelzhouh,我学这段ASP代码目的是想用fso删除数据库中涉及到的图片。 展开
'删除
if Request.QueryString("title") = "del" then
dim id,sort,name,sqlsort,selectid
id = int(Request.Form("id"))
sort = int(Request.Form("sort"))
name = trim(Request.form("name"))
BigClassName = trim(Request.QueryString("BigClassName")) '类别
NoncePage = int(Request.QueryString("page")) '当前页码
keytext = Replace(trim(Request("keytext")),"'","") '查询关键字
selectid = Request("selectid")
if selectid = "" or selectid = Empty or selectid = null then
Response.write("<script language='javascript'>alert('请先选择要删除的资料!');window.history.go(-1);</script>")
Response.end
end if
'查询所有勾选资料的图片并用FSO删除
dim rsquery,pic
set rsquery = Server.CreateObject("adodb.recordset")
rsquery.open "select * from ProductSH where id in ("&selectid&")",conn,1,1
if not rsquery.eof then
do while not rsquery.eof
pic = pic & trim(rsquery("pic")) & ","
rsquery.movenext
loop
end if
rsquery.close
dim allstr,i,all
allstr = Split(pic,",",-1) '-1表示返回所有子字符串
For i = LBound(allstr) To UBound(allstr)
delpic("../../pic/"&trim(allstr(i))) 'FSO彻底删除图片,释放空间
Next
sqlsort = "delete from [ProductSH] where id in ("&selectid&")"
conn.Execute(sqlsort)
%>
在线等啊,急!谢谢
请转译成jsp语言,以便我学习。
回 yejunapd,虽然对我没有用,但还是谢谢你。
回 michaelzhouh,我学这段ASP代码目的是想用fso删除数据库中涉及到的图片。 展开
2个回答
展开全部
<%
'删除
if Request.QueryString("title") = "del" then //如果get传过来的title的值为"del"字符串的时候
dim id,sort,name,sqlsort,selectid //申请变量
id = int(Request.Form("id")) //表单传过来的ID,转成INT型
sort = int(Request.Form("sort")) //表单传过来的sort,转成INT型
name = trim(Request.form("name")) //表单传过来的name,去空格
BigClassName = trim(Request.QueryString("BigClassName")) '类别 //get传过来的大类名,去空格
NoncePage = int(Request.QueryString("page")) '当前页码 //get传过来的页码,去空格
keytext = Replace(trim(Request("keytext")),"'","") '查询关键字 //表单传过来的keytext,有引号时替换,去空格
selectid = Request("selectid") //表单传过来的selectid
if selectid = "" or selectid = Empty or selectid = null then //如果selectid为空或者selectid 没东西则弹出下面JAVA
script
Response.write("<script language='javascript'>alert('请先选择要删除的资料!');window.history.go(-1);</script>")
Response.end //结束
end if //结束判断语句
'查询所有勾选资料的图片并用FSO删除
dim rsquery,pic //定义变量
set rsquery = Server.CreateObject("adodb.recordset") //连接数据库
rsquery.open "select * from ProductSH where id in ("&selectid&")",conn,1,1 //数据库id=selectid的所有相关信息
if not rsquery.eof then //如果没到结尾则
do while not rsquery.eof //没到结尾则循环
pic = pic & trim(rsquery("pic")) & "," //pic+表单pic+,
rsquery.movenext //往下读
loop //循环
end if //结束判断
rsquery.close //结束
dim allstr,i,all //定义变量
allstr = Split(pic,",",-1) //读出PIC,按,号分离 '-1表示返回所有子字符串
For i = LBound(allstr) To UBound(allstr) //转大小写
delpic("../../pic/"&trim(allstr(i))) 'FSO彻底删除图片,释放空间 //删除指定PIC
Next
sqlsort = "delete from [ProductSH] where id in ("&selectid&")" //删除数据库 id=selectid的相关数据
conn.Execute(sqlsort) //执行SQL语句
%>
虽然本人能力有限,希望还是对你有所帮助
'删除
if Request.QueryString("title") = "del" then //如果get传过来的title的值为"del"字符串的时候
dim id,sort,name,sqlsort,selectid //申请变量
id = int(Request.Form("id")) //表单传过来的ID,转成INT型
sort = int(Request.Form("sort")) //表单传过来的sort,转成INT型
name = trim(Request.form("name")) //表单传过来的name,去空格
BigClassName = trim(Request.QueryString("BigClassName")) '类别 //get传过来的大类名,去空格
NoncePage = int(Request.QueryString("page")) '当前页码 //get传过来的页码,去空格
keytext = Replace(trim(Request("keytext")),"'","") '查询关键字 //表单传过来的keytext,有引号时替换,去空格
selectid = Request("selectid") //表单传过来的selectid
if selectid = "" or selectid = Empty or selectid = null then //如果selectid为空或者selectid 没东西则弹出下面JAVA
script
Response.write("<script language='javascript'>alert('请先选择要删除的资料!');window.history.go(-1);</script>")
Response.end //结束
end if //结束判断语句
'查询所有勾选资料的图片并用FSO删除
dim rsquery,pic //定义变量
set rsquery = Server.CreateObject("adodb.recordset") //连接数据库
rsquery.open "select * from ProductSH where id in ("&selectid&")",conn,1,1 //数据库id=selectid的所有相关信息
if not rsquery.eof then //如果没到结尾则
do while not rsquery.eof //没到结尾则循环
pic = pic & trim(rsquery("pic")) & "," //pic+表单pic+,
rsquery.movenext //往下读
loop //循环
end if //结束判断
rsquery.close //结束
dim allstr,i,all //定义变量
allstr = Split(pic,",",-1) //读出PIC,按,号分离 '-1表示返回所有子字符串
For i = LBound(allstr) To UBound(allstr) //转大小写
delpic("../../pic/"&trim(allstr(i))) 'FSO彻底删除图片,释放空间 //删除指定PIC
Next
sqlsort = "delete from [ProductSH] where id in ("&selectid&")" //删除数据库 id=selectid的相关数据
conn.Execute(sqlsort) //执行SQL语句
%>
虽然本人能力有限,希望还是对你有所帮助
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询