<!--#include file="../SQLconn.asp"-->
 

<%  
   xingqi=request("xingqi")
   jieci=request("jieci")
   anpai=request("anpai")
   
   '清除失效的课程表
   set rsdel=server.createobject("adodb.recordset")
   sqldel="delete   from CalendarPlan  where beginTime='"&xingqi& "'  and endTime not in (select vname from  varset where name='作息时间') and planMan='"&request.cookies("tname")& "'"
   rsdel.open sqldel,conn,1,1
   rsdel.close
   
   set rs=server.createobject("adodb.recordset")
   sql="delete   from CalendarPlan  where beginTime='"&xingqi& "'  and endTime='"&jieci& "' and planMan='"&request.cookies("tname")& "'"
   rs.open sql,conn,1,1
   rs.close
    
   if anpai<>"" then
   set RsPlan=server.createobject("adodb.recordset")
   RsPlansql="select * from CalendarPlan where (cid is null)" 
   RsPlan.open RsPlansql,conn,1,3
   RsPlan.addnew

   RsPlan("beginTime")=xingqi
   RsPlan("endTime")=jieci
   RsPlan("PlanType")="课程安排"
   RsPlan("title")=anpai
   RsPlan("planMan")=request.cookies("tname")
   RsPlan("username")=request.cookies("tname")
   RsPlan.update
   RsPlan.close
	
   set RsPlan=nothing  
   end if
   conn.close
   set conn=nothing
   response.redirect   "calendar.asp"
%>
 
 

 