<!-- #include file="conn.asp" -->
<!--#include file="check2.asp"-->
<%
dim menuid
dim i,strid,sql
dcid=request("dcid")
dctitle=trim(request.form("dctitle"))
adddate=now()

sql="insert into e_diaocha1 (dctitle,adddate) values('"&dctitle&"','"&adddate&"') "
conn.execute(sql)

'取得这个单的id
cussql="select id from e_diaocha1 where dctitle='"&dctitle&"' and adddate=#"&adddate&"#"
set cusrs=conn.execute(cussql)
dcid=cusrs("id")
cusrs.close
set cusrs=nothing


on error resume next
conn.BeginTrans

for i=1 to 8
	contect=trim(request.form("contect"&i))
	sql2="insert into e_diaocha2 (dcid,contect,shuliang,adddate2) values('"&dcid&"','"&contect&"','0','"&adddate&"')"
	conn.execute(sql2)
next

if conn.Errors.Count=0 then  
	conn.CommitTrans
else 
	conn.RollbackTrans
	call alert("保存数据时出错，请重新尝试！")
end if

conn.close

response.write "<script language=JavaScript>" & "alert('恭喜您，您成功设置了新的“最新调查”。');" & "window.location.href='diaocha.asp'" & "</script>"
response.end

%>


