📄 query.asp
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查询员工考勤</title>
</head><!--#include file="connection.asp"-->
<%
Set rs=Server.CreateObject("ADODB.Recordset")
DutyDateS=trim(Request("DutyDateS")+"")
DutyDateE=trim(Request("DutyDateE")+"")
Employee=trim(Request("Employee")+"")
strsql="select a.*,(select name "
strsql =strsql +"from employee where keyid=a.employeeid) as name "
strsql=strsql+" from attendance a where 1=1 "
if len(Employee)>=1 then
strsql=strsql+" and employeeid=" +Employee
end if
if len(DutyDateS)>=1 then
strsql=strsql+" and DateValue(onduty_date)>=#" +DutyDateS +"# "
end if
if len(DutyDateE)>=1 then
strsql=strsql+" and DateValue(offduty_date)<=#" +DutyDateE +"# "
end if
strsql=strsql+" order by onduty_date desc"
rs.Open strsql,con
Set empl_rs=Server.CreateObject("ADODB.Recordset")
strsql="select * from employee"
empl_rs.Open strsql,con
%>
<body>
<form name="form1" method="post" action="">
<input name="IsPostBack" type="hidden" value="PostBack">
<table width="100%" border="0">
<tr>
<td >员工: <select name="Employee" id="Employee">
<option value="" >--请选择--</option>
<% do while not (empl_rs.EOF) %>
<option value="<%=trim(empl_rs("keyid")) %>"
<% if trim(empl_rs("keyid"))=Employee then%> selected <%end if%>>
<%=empl_rs("name")%></option>
<%empl_rs.MoveNext
loop
empl_rs.Close %> </select></td>
<td >考勤日期:从<input type="text" name="DutyDateS" value="<%=DutyDateS%>">
到<input type="text" name="DutyDateE" value="<%=DutyDateE%>"></td>
</tr>
<tr>
<td ><font color="red" ><%=msgErr %></font></td>
<td align="right" >
<input type="submit" name="SubmitQuery" value="查询">
</td>
</tr>
</table>
<table width="100%" border="1">
<tr>
<td align="center" width="20%">员工姓名</td>
<td align="center" width="30%">上班时间</td>
<td align="center" width="30%">下班时间</td>
</tr>
<%do while not rs.EOF %>
<tr>
<td>
<%=trim(rs("name")) %></td>
<td><%=trim(rs("onduty_date")) %></td>
<td><%=trim(rs("offduty_date")) %></td>
</tr>
<% rs.MoveNext
loop
rs.Close
con.Close%>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -