日期:2014-05-16  浏览次数:21059 次

求大神精简下代码段
<%
set rs=server.CreateObject("adodb.recordset")
if request("id")="" then
rs.open "select * from light ",conn,1,3
rs.addnew
else
rs.open "select * from light where id="&request("id"),conn,1,3
end if
rs("usefor")=trim(request.Form("usefor"))
rs("prname")=trim(request.form("prname"))
rs("brand")=trim(request.form("brand"))
rs("room")=trim(request.form("room"))
rs("model")=trim(request.form("model"))
rs("area")=trim(request.form("area"))
rs("lightsource")=trim(request.form("lightsource"))
rs("sourcenumber")=trim(request.form("sourcenumber"))
rs("sourcetype")=trim(request.form("sourcetype"))
rs("power")=trim(request.form("power"))
rs("technology")=trim(request.form("technology"))
rs("origin")=trim(request.form("origin"))
rs("material1")=trim(request.form("material1"))
rs("material2")=trim(request.form("material2"))
rs("style")=trim(request.form("style"))
rs("picname")=trim(request.form("picname"))
rs("issuer")=Session("adminid")
rs("textarea")=request.form("textarea")
rs("pictime")=date()
rs.update
rs.close
response.write "<script language='javascript'>"
response.write "alert('发布成功.');"
response.write "window.location.href='importlist.asp';"
response.write "</script>"
%>

<%
dim request2
set request2=New UpLoadClass
'设置文件允许的附件类型为gif/jpg
request2.FileType=""
'设置服务器文件保存路径
request2.SavePath="ppic/"
'单文件最大1mb
request2.MaxSize =1024*1024*10
'自动生成无重复文件名保存目标文件
request2.AutoSave = 0
request2.open
file1=""
select case request2.form("ppic_Err")
case 1:
response.write "<script language='javascript'>"
response.write "alert('文件太大,上传失败!');"
response.write "window.history.back();"
response.write "</script>"
response.end
case 2:
response.write "<script language='javascript'>"
response.write "alert('文件格式错误,上传失败!');"
response.write "window.history.back();"
response.write "</script>"
response.end
case 3:
response.write "<script language='javascript'>"
response.write "alert('文件大小超过限定并且格式错误,上传失败!');"
response.write "window.history.back();"
response.write "</script>"
response.end
case 0:
file1=request2.form("ppic")
end select

set rs=server.CreateObject("adodb.recordset")
rs.open "select * from light",conn,1,3