📄 worker_edit.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../login/check_power.asp"-->
<%
if check_power("员工管理")=0 then
response.redirect("/login/check_false.asp")
else%> <%
' *** Update Record: construct a sql update statement and execute it
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
MM_tableName = "db_worker"
MM_tableCol = "id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_fields = "login,login,',none,'',card,card,',none,'',name,name,',none,'',sex,sex,',none,'',birthday,birthday,',none,NULL,homeman_id,homeman_id,none,none,NULL,hometown,hometown,',none,'',face,face,',none,'',worksite,worksite,',none,'',cardnumb,cardnumb,',none,'',godate,godate,',none,NULL,link,link,',none,'',homeaddr,homeaddr,',none,'',memo,memo,',none,''"
MM_redirectPage = "worker_show.asp"
' create the sql update statement
MM_updateStr = "update " & MM_tableName & " set "
MM_fieldsArray = Split(MM_fields, ",")
For i = LBound(MM_fieldsArray) To UBound(MM_fieldsArray) Step 5
FormVal = CStr(Request.Form(MM_fieldsArray(i)))
Delim = MM_fieldsArray(i+2)
If (Delim = "none") Then Delim = ""
AltVal = MM_fieldsArray(i+3)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_fieldsArray(i+4)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fieldsArray)) Then
MM_updateStr = MM_updateStr & ","
End If
MM_updateStr = MM_updateStr & MM_fieldsArray(i+1) & " = " & FormVal
Next
MM_updateStr = MM_updateStr & " where " & MM_tableCol & " = " & MM_recordId
' finish the sql and execute it
Set MM_updateCmd = Server.CreateObject("ADODB.Command")
MM_updateCmd.ActiveConnection = "dsn=hotel;"
MM_updateCmd.CommandText = MM_updateStr
MM_updateCmd.Execute
' redirect with URL parameters
If (MM_redirectPage = "") Then
MM_redirectPage = CStr(Request("URL"))
End If
If (InStr(1, MM_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_redirectPage = MM_redirectPage & "?" & Request.QueryString
End If
Call Response.Redirect(MM_redirectPage)
End If
%> <%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = "dsn=hotel;"
Recordset1.Source = "SELECT * FROM view_worker_basic where id="&request.querystring("id")
'Recordset1.Source = "SELECT * FROM view_worker_basic"
Recordset1.CursorType = 3
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open
Recordset1_numRows = 0
%>
<%
set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = "dsn=hotel;"
Recordset2.Source = "SELECT * FROM view_homeman"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open
Recordset2_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language=javascript>
<!--
function goworker_show(){
location.assign("worker_show.asp");
}
//-->
</script>
<body bgcolor="#FFFFFF">
当前员工编号: <%=(Recordset1.Fields.Item("id").Value)%>
<hr>
<form name="form1" method="post" action="<%=MM_editAction%>">
<p>登录用户:
<input type="text" name="login" size="30" value="<%=(Recordset1.Fields.Item("login").Value)%>">
</p>
<p>工作卡号:
<input type="text" name="card" size="30" value="<%=(Recordset1.Fields.Item("card").Value)%>">
</p>
<p>姓名:
<input type="text" name="name" size="30" value="<%=(Recordset1.Fields.Item("name").Value)%>">
</p>
<p>性别:
<select name="sex">
<option value="男" <%if Recordset1.Fields.Item("sex").Value="男" then%> selected<%end if%>>男</option>
<option value="女" <%if Recordset1.Fields.Item("sex").Value="女" then%> selected<%end if%>>女</option>
</select>
</p>
<p>出生年月日:
<input type="text" name="birthday" value="<%=(Recordset1.Fields.Item("birthday").Value)%>">
(日期格式:9999-99-99)</p>
<p>民族:
<select name="homeman_id">
<%
While (NOT Recordset2.EOF)
%>
<option value="<%=(Recordset2.Fields.Item("id").Value)%>" <%if (Recordset2.Fields.Item("id").Value = Recordset1.Fields.Item("homeman_id").Value) then Response.Write("SELECTED") : Response.Write("")%>><%=(Recordset2.Fields.Item("name").Value)%></option>
<%
Recordset2.MoveNext()
Wend
%>
</select>
</p>
<p>籍贯:
<input type="text" name="hometown" size="30" value="<%=(Recordset1.Fields.Item("hometown").Value)%>">
</p>
<p>政治面貌:
<input type="text" name="face" size="30" value="<%=(Recordset1.Fields.Item("face").Value)%>">
</p>
<p>工作职务:
<input type="text" name="worksite" size="30" value="<%=(Recordset1.Fields.Item("worksite").Value)%>">
</p>
<p>身份证号:
<input type="text" name="cardnumb" size="30" value="<%=(Recordset1.Fields.Item("cardnumb").Value)%>">
</p>
<p>来店日期:
<input type="text" name="godate" size="30" value="<%=(Recordset1.Fields.Item("godate").Value)%>">
(日期格式:9999-99-99)</p>
<p>联系方法:
<input type="text" name="link" size="30" value="<%=(Recordset1.Fields.Item("link").Value)%>">
</p>
<p>常住地址:
<input type="text" name="homeaddr" size="30" value="<%=(Recordset1.Fields.Item("homeaddr").Value)%>">
</p>
<p>备注: <br>
<textarea name="memo" cols="50" rows="5"><%=(Recordset1.Fields.Item("memo").Value)%></textarea>
</p>
<p>
<input type="submit" name="Submit" value="保 存">
<input type="reset" name="Submit2" value="取 消">
<input type="button" name="Submit3" value="返 回" onclick="goworker_show()">
<input type="hidden" name="id" value=<%=(Recordset1.Fields.Item("id").Value)%>>
</p>
<input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("id").Value %>">
<input type="hidden" name="MM_update" value="true">
</form>
</body>
</html>
<%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -