📄 worker_add.asp
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../login/check_power.asp"-->
<%
if check_power("员工管理")=0 then
response.redirect("/login/check_false.asp")
else%> <%
' *** Insert Record: construct a sql insert 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_insert")) <> "") Then
MM_tableName = "db_worker"
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 insert sql statement
MM_tableValues = ""
MM_dbValues = ""
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_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_fieldsArray(i+1)
MM_dbValues = MM_dbValues & FormVal
Next
MM_insertStr = "insert into " & MM_tableName & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
' finish the sql and execute it
Set MM_insertCmd = Server.CreateObject("ADODB.Command")
MM_insertCmd.ActiveConnection = "dsn=hotel;"
MM_insertCmd.CommandText = MM_insertStr
MM_insertCmd.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"
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.recordcount)%>
<hr>
<form name="form1" method="post" action="<%=MM_editAction%>">
<p>登录用户:
<input type="text" name="login" size="30">
</p>
<p>工作卡号:
<input type="text" name="card" size="30">
</p>
<p>姓名:
<input type="text" name="name" size="30">
</p>
<p>性别:
<select name="sex">
<option value="男" selected>男</option>
<option value="女">女</option>
</select>
</p>
<p>出生年月日:
<input type="text" name="birthday">
(日期格式:9999-99-99)</p>
<p>民族:
<select name="homeman_id">
<%
While (NOT Recordset2.EOF)
%>
<option value="<%=(Recordset2.Fields.Item("id").Value)%>"><%=(Recordset2.Fields.Item("name").Value)%></option>
<%
Recordset2.MoveNext()
Wend
%>
</select>
</p>
<p>籍贯:
<input type="text" name="hometown" size="30">
</p>
<p>政治面貌:
<input type="text" name="face" size="30">
</p>
<p>工作职务:
<input type="text" name="worksite" size="30">
</p>
<p>身份证号:
<input type="text" name="cardnumb" size="30">
</p>
<p>来店日期:
<input type="text" name="godate" size="30">
(日期格式:9999-99-99)</p>
<p>联系方法:
<input type="text" name="link" size="30">
</p>
<p>常住地址:
<input type="text" name="homeaddr" size="30">
</p>
<p>备注: <br>
<textarea name="memo" cols="50" rows="5"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="保 存">
<input type="reset" name="Submit2" value="取 消">
<input type="button" name="Submit3" value="返 回" onclick="goworker_show()">
</p>
<input type="hidden" name="MM_insert" value="true">
</form>
</body>
</html>
<%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -