asp if语句嵌套问题,请教高手!!!

2024-12-31 14:43:56
推荐回答(2个)
回答1:

<%
cp_number=request.form("cp_number_text")
cp_name=request.form("cp_name_text")
cp_guige=request.form("cp_guige_select")
cp_miaoxu=request.form("cp_miaoxu_text")
cp_jiego=request.form("cp_jiego_select")
cp_version="V"& request.form("cp_version_text")
cp_fangxiangxi=request.form("cp_fangxiangxi_select")
cp_remark=request.form("cp_remark_text")
cp_output=request.form("cp_output_select")
cp_huanbao=request.form("cp_huanbao_select")
cp_state=request.form("cp_state_select")
cp_addtime=request.form("cp_addtime_text")
cp_file_name=request.form("cp_filename_text")
Server_MapPath=request.ServerVariables("APPL_PHYSICAL_PATH")

Dim bb,cc,dd
bb=InstrRev(cp_file_name,"\")
cc=len(cp_file_name)
file_name=Right(cp_file_name,cc-bb)
Target_MapPath=Server_MapPath & "/upload/cp/" & cp_number & "-" & cp_version & ".doc"

cp1_sql="select * from cp_list where cp_number ='"& cp_number & "'"
set cp1=server.createobject("adodb.recordset")
cp1.open cp1_sql,conn,1,1
if not cp1.eof then
response.write""

if cp_number<>""and cp_name<>""and cp_guige<>""and cp_miaoxu<>""and cp_state<>""and cp_jiego<>""and cp_version<>""and cp_fangxiangxi<>""and cp_output<>""and cp_huanbao<>""and cp_file_name<>"" then
set cp=server.createobject("adodb.recordset")
cp_sql="select * from cp_list"
cp.open cp_sql,conn,1,3
cp.addnew
cp("cp_number")=cp_number
cp("cp_name")=cp_name
cp("cp_guige")=cp_guige
cp("cp_miaoxu")=cp_miaoxu
cp("cp_version")=cp_version
cp("cp_jiego")=cp_jiego
cp("cp_fangxiangxi")=cp_fangxiangxi
cp("cp_state")=cp_state
cp("cp_remark")=cp_remark
cp("cp_output")=cp_output
cp("cp_huanbao")=cp_huanbao
cp("cp_addtime")=cp_addtime
cp("cp_file_name")=cp_number & "-" & cp_version & ".doc"
cp("cp_delete")="f"
cp("cp_add_r")=session("name")
cp.update

set wj=server.createobject("adodb.recordset")
sql="select * from files_list"
wj.open sql,conn,1,3
wj.addnew
wj("files_name")=cp_number
wj("files_version")=cp_version
wj("files_type")=cp_name
wj("files_address")=Target_MapPath
wj.update
Set fs=server.createobject("scripting.filesystemobject")
If fs.fileexists(cp_file_name) then
fs.copyfile cp_file_name,Target_MapPath,True
end if

Response.Redirect "cp_add_s1.asp"
else
response.write""
end if

回答2:

Response.Redirect 后的地址是不是错了?是不是又回到这个添加页了。。如果又回到添加页而没有提交数据就会出现你说的错误了。