📄 custedit.asp
字号:
<!--#include file="../../conndb.asp"-->
<html>
<head>
<title>编辑客户单位信息</title>
<link rel="stylesheet" type="text/css" href="../../style.CSS">
<Script Language="JavaScript">
//域校验
function CheckFlds(){
if (document.form1.custname.value==""){
alert("请输入单位名称!");
form1.custname.focus;
return false;
}
return true;
}
</Script>
</head>
<body leftmargin="1" topmargin="0">
<%
Dim CustName, CustTypeId, Address, Postcode, AreaId, BussTypeId, EmpId, EmpName
Dim Action
'变量初始化
Action = "add"
CustName= ""
CustTypeId=0
Address= ""
Postcode= ""
AreaId= 0
BussTypeId= 0
EmpId= 0
' 当前编辑的客户单位编号
Dim CustId
'读取参数cid
CustId = Request.QueryString("cid")
If IsEmpty(CustId) Then
CustId = "0"
End If
'读取参数action
Action = Request.QueryString("action")
'编辑记录
If Action = "edit" Then
'设置SELECT语句,读取记录数据
sql = "SELECT * FROM Customer WHERE CustId=" & CustId
Set rs = Conn.Execute(sql)
If Not rs.EOF Then
CustName = rs("CustName")
CustTypeId = rs("CustTypeId")
Address = rs("Address")
Postcode = rs("Postcode")
AreaId = rs("AreaId")
BussTypeId = rs("BussTypeId")
EmpId = rs("EmpId")
'读取员工姓名信息
sql = "SELECT EmpName FROM Employees WHERE EmpId=" & EmpId
Set rs1 = Conn.Execute(sql)
If Not rs1.Eof Then
EmpName = rs1("EmpName")
End If
rs1.Close ' 关闭记录集,以备下次使用
End If
rs.Close ' 关闭记录集,以备下次使用
End If
%>
<form name="form1" method="POST" action="CustSave.asp?action=<%=Action%>&cid=<%=CustId%>" onsubmit="return CheckFlds()">
<br>
<table align="center" border="1" cellspacing="0" width="96%" bordercolor="#64B9E1" bordercolorlight="#64B9E1" bordercolordark="#FFFFFF">
<tr>
<td bgcolor="#FFFFFF" colspan="4" height="29" width="90%">
<p align="center"><b><font face="幼圆" color="#000080" size="4">客户单位信息</font></b></p>
</td>
</tr>
<tr>
<td width="20%" bgcolor="#CEE7FF">单位名称</td>
<td width="40%">
<input type="text" name="custname" size="20" value="<%=CustName%>"> </td>
<td width="20%" bgcolor="#CEE7FF">所属类型</td>
<td width="40%"><select size="1" name="CustTypeId">
<%
' 读取客户类型信息
Dim rs1
sql = "SELECT * FROM Types WHERE flag=4"
Set rs1 = Conn.Execute(sql)
Do While Not rs1.EOF
%>
<option
<% If rs1("TypeId") = CustTypeId Then %>
selected
<% End If %>
value="<%=rs1("TypeId")%>"><%=rs1("TypeName")%></option>
<% rs1.MoveNext
Loop
rs1.Close
%>
</select> </td>
</tr>
<tr>
<td bgcolor="#CEE7FF">通信地址</td>
<td>
<input type="text" name="address" size="20" value="<%=Address%>"> </td>
<td bgcolor="#CEE7FF">邮政编码</td>
<td><input type="text" name="postcode" size="20" value="<%=Postcode%>"> </td>
</tr>
<tr>
<td bgcolor="#CEE7FF">所在地域</td>
<td><select size="1" name="AreaId">
<%
' 读取地域信息
Dim rs2
sql = "SELECT * FROM Area WHERE UpperId=0"
Set rs1 = Conn.Execute(sql)
Do While Not rs1.EOF
%>
<option
<% If rs1("AreaId") = AreaId Then %>
selected
<% End If %> value="<%=rs1("AreaId")%>"><%=rs1("AreaName")%></option>
<%
' 读取二级地域
sql = "SELECT * FROM Area WHERE UpperId=" & rs1("AreaId")
Set rs2 = Conn.Execute(sql)
Do While Not rs2.Eof
%>
<option
<% If rs2("AreaId") = AreaId Then %>
selected
<% End If%>
value="<%=rs2("AreaId")%>">-- <%=rs2("AreaName")%></option>
<%
rs2.MoveNext
Loop
rs2.Close
rs1.MoveNext
Loop
rs1.Close
%>
</select> </td>
<td bgcolor="#CEE7FF">行业类型</td>
<td><select size="1" name="BussTypeId">
<%
' 读取行业类型信息
sql = "SELECT * FROM Types WHERE flag=5"
Set rs1 = Conn.Execute(sql)
Do While Not rs1.EOF
%>
<option
<% If rs1("TypeId") = BussTypeId Then %>
selected
<% End If %>
value="<%=rs1("TypeId")%>"><%=rs1("TypeName")%></option>
<% rs1.MoveNext
Loop
rs1.Close
%>
</select></td>
</tr>
<tr>
<td bgcolor="#CEE7FF">销售人员</td>
<td><input type="text" name="empname" size="11" value="<%=EmpName%>">
<input type="hidden" name="empid" size="20" value="<%=EmpId%>">
<input type="button" value="选择" onclick="javascript:news=window.open('empsel.asp','news','left=300,top=200,height=300,width=200,status=no,toolbar=no,menubar=no,scrollbars=no,location=no,resizable=no');news.focus();" name="B3" style="font-family: 宋体; font-size: 9pt"></font>
</td>
<td bgcolor="#CEE7FF"> </td>
<td> </td>
</tr>
</table>
<p align=center><input type="submit" value=" 提 交 " name="B1">
<input type="reset" value=" 重 写 " name="B2"></p>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -