如何将表单上的数据存入数据库表??急!!!

山水无言 2003-06-22 04:41:01
在一个数据库表中存有考核人与被考核人的对应关系(假设为表A),当某考核人登录后,显示一个表单,包含字段有:考核人、被考核人、最高分、实际分。其中实际分我用一个文本框实现,以便让考核人输入(说明:(1)该文本框的默认值等于最高分,(2)该表单只有一个提交按钮,(3) 不同的人登录显示的表单的记录数不同)。
所有文本框输入完毕,提交后,我想让考核人、被考核人、最高分、实际分写入表B中,请问如何写数据到表B?

附:从表A读取数据并显示部分的表单代码如下:
<%LANGUAGE=VBScript%>
<%
keyword=session("gh")
jhy=session("name")
%>
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "DSN=sxkd;UID=web;ConnectString=sxkd;PWD=smweb"
Set rs= Server.CreateObject("ADODB.Recordset")
Set rs1= Server.CreateObject("ADODB.Recordset")

SQL="select username,sub_group1,supervisor_name,sub_group2,leibie,quanzhong from sx_diaocha_info where supervisor_name='"&jhy&"' order by leibie,username"
SQL1="select count(*) as gs from sx_diaocha_info where supervisor_name='"&jhy&"'"

rs.open sql,conn,,1
rs1.open sql1,conn,,1
%>

<html>
<head>
<title>打分表单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<style type="text/css">
A:link {COLOR: #FFFFFF; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:visited {COLOR: #FFFFFF; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:active {COLOR: #FFFFFF; FONT-FAMILY: 宋体; TEXT-DECORATION: none}
A:hover {COLOR: #FFFFFF; TEXT-DECORATION: none}
BODY {FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
TH {FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
TD {FONT-FAMILY: 宋体; FONT-SIZE: 9pt}
select {background-color: #CCFFCC}
table {line-height: 15pt}
</style>

<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body bgcolor="#990000" text="#000000" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<div id="Layer1" style="position:absolute; width:724px; height:146px; z-index:1; left: 13px; top: 5px">
<div align="center"><b><font size="5" color="#FFFFCC">打分表单</font></b><br>
<font size="4" color="#333399"><font color="#000000" size="3"></font></font>
<br>
<div align="left"> 
<table width="605">
<tr>
<td width="88"> 【<a href="javascript:window.close()">关闭窗口</a>】 </td>
<td width="216"><font size="3">你可为<%=rs1("gs")%>位员工打分</font></td>
<td width="285"><font size="3"><b>考核人</b></font>:<font size="3" color="#FFFFFF"><%=rs("supervisor_name")%></font></td>
</tr>
<tr>
<td width="88"> </td>
</tr>
</table>
</div>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#336633" bordercolorlight="#000000" bordercolordark="#ffffff">
<tr bgcolor="#996600">
<td width="18%">
<div align="center"><font size="3"><b>被考核人</b></font></div>
</td>
<td width="20%">
<div align="center"><font size="3"><b>类别</b></font></div>
</td>
<td width="14%">
<div align="center"><font size="3"><b>最高分</b></font></div>
</td>
<td width="28%">
<div align="center"><font size="3"><b>实际得分</b></font></div>
</td>
</tr>
<% do while not rs.eof %>
<tr>
<td width="18%" align="center" bgcolor="#999999"><%=rs("username")%></td>
<td width="20%" align="center" bgcolor="#CCCCCC"><%=rs("leibie")%></td>
<td width="14%" align="center" bgcolor="#CCCCCC"><%=rs("quanzhong")%></td>
<td width="28%" align="center" bgcolor="#336699">
<div align="center"><font size="3">
<div align="center"> </div>
<div align="center">
<input type="text" name="sjdf" size="3" value="<%=rs("quanzhong")%>" maxlength="3">
<font color="#FFFFFF">注意:不能大于最高分</font></div>
</font></div>
</td>
</tr>
<%
rs.movenext
loop
rs1.close
set rs1=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</table>
<div align="left">
<table width="605">
<tr>
<td width="89">【<a href="javascript:window.close()">关闭窗口</a>】</td>
<td width="234"> </td>
<td width="266">  </td>
</tr>
</table>
</div>
<br>
</div>
</div>

</body>
</html>
...全文
1167 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
mjwgtm 2003-06-23
  • 打赏
  • 举报
回复
rs.addnew
rs("数据库字段")=名插入的值
...
...
rs.update
rs.close
叶子哟 2003-06-22
  • 打赏
  • 举报
回复
写就是了,根据request.form("你的东东")的值写入
用insert b(a,b,c,...) values('a对应的值','','',...)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧