一个添加值班表的问题?
请高手帮忙看看,为什么添加的值班表总是天数不对?不知道应该怎么改?程序代码:
<% function zhuanghu(yea,mon) dat1=yea&"-"&mon&"-1" dat=datepart("d",dateadd("d",-1,dat1)) zhuanghu=dat end function %> <% '变量定义 dim action,classid,id,url,pic action = trim(request.querystring("action")) classid = trim(request.QueryString("classid")) id = trim(request.QueryString("id")) url = request.servervariables("http_referer") %> <% '循环开始 select case action '//推荐 case "add" %> <form action="?action=addok" method="post" name="form" id="form"> <table width="100%" border="0" cellspacing="1" cellpadding="0" align="center"> <tr> <th colspan=8 style="text-align:center;">添加值班人员</th> </tr> <% dim y,m,i set rs=server.CreateObject("adodb.recordset") rs.open "select top 1 * from zhiban order by id desc ",conn,1,3 y=rs("y") m=rs("m") rs.Close set rs=nothing if m=12 then y=y+1 m=1 else m=m+1 end if t=zhuanghu(y,m) for i=1 to t Step 1 %> <tr> <td width="96" height=30 >值班时间 <%if i=1 then %> <input name="HIde" type="hidden" value="<%=t%>"> <input name="y" type="hidden" value="<%=y%>"> <input name="m" type="hidden" value="<%=m%>"> <%end if%> </td> <td width="89"><input name="date<%=i%>" type="text" id="date<%=i%>" size="10" value="<%=y&"-"&m&"-"&i%>"></td> <td width="145" >带班领导</td> <td width="198" ><input name="lingdao<%=i%>" type="text" id="lingdao<%=i%>" size="30" value=""></td> <td width="153" >值班人员</td> <td width="188" ><input name="yuangong<%=i%>" type="text" id="yuangong<%=i%>" size="30" value=""></td> <td width="149" >值班电话</td> <td width="223" > <input name="siji<%=i%>" type="text" id="siji<%=i%>" size="30" value=""></td> </tr> <% Next %> <tr> <td width="96" height=24 > </td> <td width="89" > </td> <td width="145" class="td2"> </td> <td width="198" class="td2"> </td> <td width="153" class="td2"> </td> <td width="188" class="td2"> </td> <td width="149" class="td2"> </td> <td width="223" class="td2"> <input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td> </tr> </table> </form>