课程删除源代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
dim student_name,student_no
student_name=session("student_name")
student_no=session("student_no")
student_password=session("student_password")
if session("student_name")=empty then
response.write "<div align=""center"">您还没有登录,请<a href=""signup.asp"">返回</a> 登录</div>"
d
end if
' 建立Connection 对象
set conn= Server.CreateObject("tion")
'定义OLE DB连接字符串
'provider="provider=microsoft.jet.oledb.4.0;"
'dbpath="data source="&server.mappath("/webtest/data/webtest.mdb")
'打开连接
'conn.open provider & dbpath
cnnstr="DBQ=" + server.mappath("data/webtest.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
'打开连接
'conn.open provider & dbpath
conn.open cnnstr
'创建command对象
set cmd=server.CreateObject("adodbmand")
'将connection对象指定给command对象
set cmd.activeconnection=conn
'创建recordset对象
set rs= Server.CreateObject("dset")
rs.locktype=2 '将锁定类型设为保守式
dim sql1
asp网页源码 sql1="select 所学课程 from student_subject where 学生学号='"&student_no&"' "
rs.open sql1,conn, 3
f then
response.write "<div align=""center"">您还没有选择课程,请<a href=""s_select_subject.asp"">返回</a> 选择课程</div>"
rs.close
d
end if
%>
<html>
<head>
<title>学生删除课程</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor=#3399CC>
<h1 align="center">
<% =session("student_name") %>
同学删除课程</h1>
<hr>
<% if request("send")=empty then %>
<div align="center">
<form name="s_del_subject_form" method="post" action="">
<table width="70%" border="1" align="center" bordercolor="#000000">
<tr>
<td><table width="100%" border="0" align="center">
<tr>
<td colspan="2"><div align="center">
</div></td>
</tr>
<% rs.MoveFirst ' 将当前的数据记录移到第一项%>
<% While Not rs.EOF ' 判断是否已经过了最后一项 %>
<tr>
<td><div align="right">
<input type="checkbox" name="subject" value=<%= rs(0) %>>
</div></td>
<td width="49%" colspan="-4"><%= rs(0) %></td>
</tr>
<% rs.MoveNext ' 移到下一项 %>
<%
Wend
%>
<tr>
<td colspan="2"><div align="center">
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="ok" value="确定删除">
</div></td>
</tr>
</table></td>
</tr>
</table>
<input name="send" type="hidden" value="send">
</form>
<% else %>
<%
subject_array=split(request("subject"),",")
for i=0 to ubound(subject_array)
dim subject
dim sql2
subject=trim(subject_array(i))
sql2="delete from student_subject where 学生学号='"&student_no&"' and 所学课程='"&subject&"'"
cmd.Commandtext=sql2
cmd.Execute
next
conn.close
%>
<%= "<p> </p><div align=""center"">您删除了下面这些的课程</div><br><br>" %>
<table width="29%" border="0" align="center">
<tr>
<td>
<%
subjects=replace(request("subject"),",","<li>")
response.write "<ul><li>" & subjects & "</ul>"
%>
<p> </p><p> </p><p> </p><p> </p>
<%= "<p align=""center""><a href=""student_main.asp"">返回</a> </p>" %>
</td>
</tr>
</table>
<% end if %>
<p> </p>
</div></body>
</html>
选择课程源代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
dim student_name,student_no
student_name=session("student_name")
student_no=session("student_no")
if session("student_name")=empty then
response.write "<div align=""center"">您还没有登录,请<a href=""student_signup.asp"">返回</a> 登录</div>"
d
end if
' 建立Connection 对象
set conn= Server.CreateObject("tion")
'定义OLE DB连接字符串
'provider="provider=microsoft.jet.oledb.4.0;"
'dbpath="data source="&server.mappath("/webtest/data/webtest.mdb")
'打开连接
'conn.open provider & dbpath
cnnstr="DBQ=" + server.mappath("data/webtest.mdb") + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
'打开连接
'conn.open provider & dbpath
conn.open cnnstr
'创建command对象
set cmd=server.CreateObject("adodbmand")
'将connection对象指定给command对象
set cmd.activeconnection=conn
'创建recordset对象
set rs= Server.CreateObject("dset")
rs.locktype=2 '将锁定类型设为保守式
set rs5= Server.CreateObject("dset")
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论