asp请假系统我写了申请页面 怎么在保存后把信息存入数据库做出审核页面实现审批

怎么用保存按钮把请假信息存进数据库并且做出审核页面
2025-05-22 08:38:58
推荐回答(1个)
回答1:

1.申请页面:shengqing.asp




















申请人:

*
请假天数:
备注: *



2.写入数据库代码 shengqingSave.asp
建个表:shengqingjilu
字段:
id 编号
S_name 申请人
num 请假天数
S_content 备注
S_ok 审批判断
S_time 申请时间
等根据你需要再加

<%@LANGUAGE="VBSCRIPT" CodePage="65001"%>
<%
Response.CharSet = "utf-8"
Session.CodePage = "65001"
%>



<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select top 1 * from shengqingjilu"
rs.open sql,conn,1,3
rs.addnew
rs("S_name")=trim(request.form("S_name"))
rs("num")=trim(request.form("num"))
rs("S_content")=trim(request.form("S_content"))
rs("S_ok")=false '待审批 ,当为true 通过审批 否则为 未通过审批 根据这个进行判断

rs.Update
rs.Close
set rs=nothing

response.write ""
response.End
%>

3.申请记录/审核页面:

<%
sqlstr="select * from shengqingjilu order by id desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sqlstr,conn,1,1
if rs.eof or rs.bof then
response.Write "还没有申请信息!"
else
do while not (rs.eof or rs.bof)
%>







 [">删除]      时间:<%=rs("s_time")%>     

<%
response.Write("编辑 ")
if rs("S_ok")=true then
response.Write("已通过审批")
else
response.Write("未通过审批")
end if
%>

申请人:<%=rs("S_name")%>
请假天数:<%=rs("num")%>
备注:<%=rs("S_content")%>

<%
rs.movenext
loop
end if
%>

4.审批代码

if request("action")="s_ok" then
strIDs=request("id")
s_ok=request("s_ok")
strSQL="update shengqingjilu set s_ok="&s_ok&" Where id=" & strIDs & ""
conn.execute strSQL
end if