就是把姓名学号以及各题分数保存到数据库的表中
ASP动态表格代码如下:
- <%
- 'session.timeout=6000
- 'Server.ScriptTimeOut=2000
- dim conn,rs,sysConfig,db
- db="../data/database.mdb" '数据库文件位置
- set conn=server.createobject("adodb.connection")
- conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" &Server.MapPath(""&db&"")
- Set rs = Server.CreateObject("ADODB.Recordset")
- %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>无标题文档</title>
- <style type="text/css">
- body,td,th {
- font-size: 12px;
- }
- body {
- margin-left: 0px;
- margin-top: 00px;
- margin-right: 0px;
- margin-bottom: 0px;
- background-color: #9F0;
- }
- </style>
- </head>
- <body>
- <form id="form1" name="form1" method="post" action="savecj.asp">
- <table width="60%" border="1" align="center" cellpadding="0" cellspacing="0">
- <%
- set rs=server.CreateObject("adodb.recordset")
- rs.open "select * from TeacherPapers where PaperID="&request("id")&"",conn,1,3
- %>
- <tr>
- <td height="30" colspan="2" align="center">添加成绩</td>
- </tr>
- <tr>
- <td align="center">试卷名称</td>
- <td align="center"><%=rs("Papername")%></td>
- </tr>
- <tr>
- <td align="center">姓名</td>
- <td align="center"><input type="text" name="textfield2" id="textfield2" size="8" maxlength="3" /></td>
- </tr>
- <tr>
- <td align="center">学号</td>
- <td align="center"><input type="text" name="textfield3" id="textfield3" size="8" maxlength="11" /></td>
- </tr>
- <tr>
- <td align="center">题号</td>
- <td align="center">赋分</td>
- </tr>
- <%
- set rs=server.CreateObject("adodb.recordset")
- rs.open "select * from QuestionsXZ where PaperID="&request("id")&"",conn,1,3
-
- do while not rs.eof %>
- <tr>
- <td align='center'><%=rs("QuestionID")%></td>
- <td align='center'><input name="textfield4" type="text" id="textfield4" size="6" maxlength="3"></td>
- </tr>
- <%
- rs.movenext
- loop
- set rs=nothing %>
- <tr>
- <td colspan="2" align="center"><input type="submit" name="button" id="button" value="提交" /></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
复制代码 |