📄 edit.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<!--#include file="connection.asp"-->
<%
dutyid=trim(Request.QueryString("id")+"")+trim(Request("keyid")+"") '需要更新的考勤主键,从查询页面传入
if len(dutyid)<1 then
Response.Redirect("query.asp")
end if
isPostBack=trim(Request("IsPostBack")+"")
if isPostBack="PostBack" then
DutyTimeS=trim(Request("DutyTimeS"))
DutyTimeE=trim(Request("DutyTimeE"))
checked=true '用于判断所有信息是否合法,如合法则保存数据
if len(DutyTimeS)<1 then
checked=false
Response.Write "<script>alert('上班时间必须输入!');history.go(-1);</script>"
end if
if len(DutyTimeE)<1 then
checked=false
Response.Write "<script>alert('下班时间必须输入!');history.go(-1);</script>"
end if
if len(Employee)<1 then
checked=false
Response.Write "<script>alert('员工必须选择!');history.go(-1);</script>"
end if
if checked then
strsql="update attendance set "
strsql =strsql + "onduty_date=#"+DutyTimeS+"#"
strsql =strsql + ",offduty_date=#"+DutyTimeE+"#"
strsql =strsql +" where keyid="+dutyid
con.Execute strsql
Response.Write "<script>alert('更新员工考勤成功!');history.go(-1);</script>"
end if
end if
Set rs=Server.CreateObject("ADODB.Recordset")
strsql="select a.*,(select name "
trsql =strsql +"from employee where keyid=a.employeeid) as emplname"
strsql =strsql +" from attendance a where keyid="+dutyid
rs.Open strsql,con,1,3
%>
<body>
<form name="form1" method="post" action="">
<input name="IsPostBack" type="hidden" value="PostBack">
<input name="keyid" type="hidden" value="<%=dutyid%>">
<table width="100%" border="1" align="center">
<tr>
<td align="right" width="40%"> 员工姓名:</td>
<td width="60%" ><%trim(rs("emplname"))%></td>
</tr>
<tr>
<td align="right">上班时间:</td>
<td >
<input name="DutyTimeS" type="text" id="DutyTimeS" maxlength="16"
value="<%trim(rs("onduty_date"))%>">
</td>
</tr>
<tr>
<td align="right">下班时间:</td>
<td >
<input name="DutyTimeE" type="text" id="DutyTimeE" maxlength="16"
value="<%trim(rs("offduty_date"))%>">
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td align="center"><input type="submit" name="Submit" value="保存"></td>
</tr>
</table>
<% rs.Close
con.close %>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -