麻烦各位老师指点
麻烦各位老师指点一下,红色部分不弹出窗口,是什么原因?虽然不弹出窗口,但能正常运行。思路是预约信息(时间和预约人)提交后,
先查询库里有没有和时间重复的,如果有就弹出窗口,重新录入
如果没有,再查询库里有没有重名的,如果有就弹出窗口,重新录入
如果都没有重复的,就把提交的信息保存到数据库里。
<%
riqi=Replace(Request.Form("riqi"),"'","''")
lifashi=Replace(Request.Form("lifashi"),"'","''")
shijianduan=Replace(Request.Form("shijianduan"),"'","''")
username=Session("username")
address3 = request.servervariables("REMOTE_ADDR")
date2=now()
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("ip.mdb")
set rs = conn.execute("select * from ip where riqi=#"&riqi&"# and shijianduan like '%"&shijianduan&"%' and lifashi like '%"&lifashi&"%'")
if not rs.eof then
Response.Write "<script>alert('该时间段已被预约!请约其他时间段!');window.window.location.href='main.asp';</script>"
rs.close:set rs = nothing
else
set rs1 = conn.execute("select * from ip where riqi=#"&riqi&"# and username like '%"&username&"%' and username not like '星辉' and username not like '戈松'")
if not rs1.eof then
Response.Write "<script>alert('一天只能预约一次!请先取消今天的预约');window.window.location.href='main.asp';</script>"
rs1.close:set rs1 = nothing
else
sql="insert into ip (address3,date2,shijianduan,lifashi,riqi,username,mobile,bumen)values('"&address3&"','"&date2&"','"&shijianduan&"','"&lifashi&"','"&riqi&"','"&Session("username")&"','"&session("mobile")&"','"&session("bumen")&"')"
conn.execute sql
conn.close
End If
response.Redirect("main.asp")
rs.close:set rs = nothing
conn.Close:set conn = nothing
End If
%>