问一个先多条件查询然后在批量修改的问题(还未结啊,在线跪求)
我用上页输入的条件,来修改access数据库的记录,但是老是没有修改。我估计应该是数据库查询那块有问题,那个大人帮看看,谢谢了.数据表见图片:
程序代码:
<% starttime=request("starttime") endtime=request("endtime") in0=trim(request("in0")) out0=trim(request("out0")) namechoice=trim(request("namechoice")) set rs = server.CreateObject("adodb.recordset") 'sql="select * from tblTurnDay_Detail where date0>=#"&starttime&"# and date0<=#"&endtime&"# and cardid='"&namechoice&"' " sql="select * from tblTurnDay_Detail where 1=1" if starttime <>"" then sql = sql& "and date0 >= #"&starttime&"# " end if if endtime <>"" then sql = sql& "and date0 <= #"&endtime&"# " end if if namechoice <>"" then sql = sql& "and cardid = '"&namechoice&"' " end if rs.open sql,conn2,1,3 if rs.eof or rs.bof then response.Write "没有符合条件的记录" else do until rs.eof rs("in0") = in0 rs("out0")= out0 rs("strdesc") ="" rs.update rs.movenext loop end if %> /** 统计数据 不用看 <table width="95%" border="1" align="center" bordercolor="#FFFFFF" bgcolor="#CCFFCC"> <tr> <td>姓名</td> <td>卡号</td> <td>日期</td> <td>上班时间</td> <td>下班时间</td> <td>考勤状态</td> <td>备注</td> </tr> <% for i = 1 to rs.recordcount %> <tr> <td><%=rs("cardid")%></td> <td><%=rs("cardid")%></td> <td><%=rs("date0")%></td> <td><%=rs("in0")%></td> <td><%=rs("out0")%></td> <td><%=rs("strdesc")%></td> <td> </td> </tr> <% rs.movenext if rs.eof then exit for end if next %> </table> <%rs.close set rs = nothing conn2.close set conn2 = Nothing response.Write "<script language = javascript>alert('Modify success,修改数据统计如下');</script>" %>
[ 本帖最后由 xreins 于 2010-1-25 21:16 编辑 ]