版主麻烦您了,一定帮忙看看<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<!-- #include file="../include/conn.asp" -->
<script language="javascript">
<%
'判断是否提交
IF Request("IsSubmit")="True" Then
Dim rsAct,ygh',BH变量生命
Set rsAct=Server.CreateObject("ADODB.RecordSet")'创建记录集
Select Case Request("Action")
Case "Add"'添加操作
'获得最新的编号
ygh=request.QueryString("id")
Dim rsMaxID
Set rsMaxID=conn.Execute("select Max(编号) from pxinfo")
BH=rsMaxID.Fields(0).Value+1
rsMaxID.Close
Set rsMaxID=Nothing
'添加代码
rsAct.Open "select * from pxinfo",conn,1,3
rsAct.AddNew
rsAct("编号")=BH
rsAct("员工号")=ygh
rsAct("培训时间")=Request("pxsj")
rsAct("培训内容")=Request("pxnr")
rsAct("培训地点")=Request("pxdd")
rsAct("培训结果")=Request("pxjg")
rsAct.Update
Response.Write "alert('添加成功');"
Case "Edit"'修改操作
'修改代码
rsAct.Open "select * from pxinfo Where 编号='"&request("BH")&"'",conn,1,3
IF Not rsAct.EOF Then
rsAct("培训时间")=Request("pxsj")
rsAct("培训内容")=Request("pxnr")
rsAct("培训地点")=Request("pxdd")
rsAct("培训结果")=Request("pxjg")
rsAct.Update
Response.Write "alert('修改成功');"
Else
Response.Write "alert('修改失败');"
End IF
End Select
End IF
%>
</script>
<%
dim ActionCmd
if request("Action")="" then
ActionCmd="Add"
else
ActionCmd=request("Action")
end if
%>
</head>
<body>
<p align="center"><font color="#FF0000" size="6" face="仿宋_GB2312"><strong>添 加
员 工 计 算 机 培 训 记录</strong></font></p>
<div align="center">
<table width="907" style="border:1px;" border="1" cellpadding="0" cellspacing="0" bgcolor="#00FFFF">
<!--DWLayoutTable-->
<tr bordercolor="#333333" bgcolor="#99FFCC">
<td width="163" valign="center">
<div align="center" class="style1"><font color="#3366FF" size="5">培训时间</font></div></td>
<td width="170" valign="center">
<div align="center" class="style1"><font color="#3366FF" size="5">培训内容</font></div></td>
<td width="113" valign="center">
<div align="center" class="style1"><font color="#3366FF" size="5">培训地点</font></div></td>
<td width="127" valign="center">
<div align="center" class="style1"><font color="#3366FF" size="5">培训结果</font></div></td>
<td width="121" valign="center">
<div align="center" class="style1"><font color="#3366FF" size="5">操作</font></div></td>
</tr>
<%
Dim rspage,str
set rspage=server.CreateObject("adodb.recordset")
str="select * from pxinfo where 员工号='"&request("id")&"'"
rspage.open str,conn,2,4
do while not rspage.eof
response.Write("<tr>")
response.Write("<td align=center>"&rspage("培训时间")&"</td>")
response.Write("<td align=center>"&rspage("培训内容")&"</td>")
response.Write("<td align=center>"&rspage("培训地点")&"</td>")
response.Write("<td align=center>"&rspage("培训结果")&"</td>")
response.Write("<td align=center><a href=../admin/admin_bjpxjl.asp?Action=Edit&ID="&rspage("员工号")&"&BH="&rspage("编号")&" target=_self>编辑</a></td>")
response.Write("</tr>")
rspage.movenext
loop
%>
</table>
</div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<div align="center">
<table width="907" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="907" height="369"><div align="center">
<form action="../admin/admin_bjpxjl.asp?Action=<%=ActionCmd%> &ID=<%=Request("id")%> &BH=<%=request("BH")%> method="post" name="form1" target="_self">
<%
'操作判断
Dim pxsj,pxnr,pxdd,pxjg
'变量初始化
ygh=-1
pxsj=""
pxnr=""
pxdd=""
pxsj=""
'判断当前是否为修改操作
IF Request("Action")="Edit" Then
'读取修改的内容
Dim rsRead,bh
bh=request("BH")
Set rsRead=conn.Execute("select * from pxinfo Where 编号='"&bh&"'")
IF Not rsRead.EOF Then'判断是否读取到内容
ygh=rsRead("员工号")
pxsj=rsRead("培训时间")
pxnr=rsRead("培训内容")
pxdd=rsRead("培训地点")
pxjg=rsRead("培训结果")
End IF
rsRead.Close
Set rsRead=Nothing
End IF
%>
<table width="392" border="1" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr bordercolor="#333333">
<td height="30" valign="center"> <div align="center" class="style8"><font color="#3366FF" size="4">培训时间</font></div></td>
<td valign="center"> <div align="center">
<input type="text" name="pxsj" value="<%=pxsj%>">
</div></td>
</tr>
<tr bordercolor="#333333">
<td height="21" valign="center"> <div align="center" class="style5 style9"><font color="#3366FF" size="4">培训内容</font></div></td>
<td valign="center"> <div align="center">
<input type="text" name="pxnr" value="<%=pxnr%>">
</div></td>
</tr>
<tr bordercolor="#333333">
<td height="26" valign="center"> <div align="center" class="style8"><font color="#3366FF" size="4">培训地点</font></div></td>
<td valign="center"> <div align="center">
<input type="text" name="pxdd" value="<%=pxdd%>" >
</div></td>
</tr>
<tr bordercolor="#333333">
<td height="21" valign="center"> <div align="center" class="style8"><font color="#3366FF" size="4">培训结果</font></div></td>
<td valign="center"> <div align="center">
<input type="text" name="pxjg" value="<%=pxjg%>" >
</div></td>
</tr>
<tr bordercolor="#333333">
<td height="36" colspan="2" valign="top"> <p align="center"> </p>
<p align="center">
<input type="hidden" name="IsSubmit" value="True">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="ClearForm" value="重填">
</p></td>
</tr>
</table>
</form>
</table>
</div>
</body>
</html>