返回列表 发帖
修改模块处理代码:
<%
dim strsql,rst,sconn,conn,sql
strsql="select * from zfc2004.s124 where id='"&id1&"'"
sconn="driver={sql server};server=(local);uid=zfc2004;pwd=zfc2004;database=dbuser"
set conn=server.createobject("adodb.connection")
conn.open sconn
set rst=conn.execute(strsql)
if not rst.eof then
  rst.close()
  strsql="update  zfc2004.s124 set name='"&name1&"',sex='"&sex1&"',birth='"&birth1&"',"
  strsql=strsql&"dept='"&dept1&"',grad='"&grad1&"',zhy='"&zhy1&"'where id='"&id1&"';"
  set rst=server.createobject("adodb.recordset")
  rst=conn.execute(strsql)
  response.redirect("success1.asp")
else
  response.redirect("success4.asp")
end if
%>

浏览模块处理代码:
<%
dim strsql,rs,nums,ary,j,sconn,conn
strsql="select  * from zfc2004.s124 order by name"
sconn="driver={sqlserver};server=(local);uid=zfc2004;pwd=zfc2004;database=dbuser"
set conn=server.createobject("adodb.connection")
conn.open sconn
set rs=conn.execute(strsql)
%>
// 此处输出表头
<%for i=0 to rs.pagesize
  response.write "<tr>"
  response.write "<td bgcolor=#e5e6d3>"&rs("name")&"</td>"
  response.write "</tr>"
  rs.movenext()
  if  rs.eof then
    exit for
  end if
next%>

删除模块处理代码:
<%@ language=vbscript %>
<%dim strsql,rst,nums,ary,j,sconn,conn,id1
id1=trim(request.form("id"))
strsql="select * from zfc2004.s124 where id='"&id1&"'"
sconn="driver={sql server};server=(local);uid=zfc2004;pwd=zfc2004;database=dbuser"
set conn=server.createobject("adodb.connection")
conn.open sconn
set rst=conn.execute(strsql)
if not rst.eof then
  rst.close()
  strsql="delete from zfc2004.s124 where id='"&id1&"'"
  set rst=server.createobject("adodb.recordset")
  rst=conn.execute(strsql)
  response.redirect("success3.asp")
else
  response.redirect("success4.asp")
end if%>

插入代码:
<%name1=trim(request.form("name"))//读取表单中姓名的值
strsql="select * from zfc2004.s12 where id='"&id1&"'"
sconn="driver={sql server};server=(local);uid=zfc2004;pwd=zfc2004;database=dbuser"
set conn=server.createobject("adodb.connection")
conn.open sconn
set rst=conn.execute(strsql)
if not rst.eof then
  rst.close()
  response.redirect("success5.asp")
else
  sqlstr="insert into zfc2004.s12 values('"&name1&"','"&sex1&"','"&birth1&"','"&id1&"','"&dept1&"','"&zhy1&"','"&grad1&"')"
  set rst=server.createobject("adodb.recordset")
  rst=conn.execute(sqlstr)
  response.redirect("success.asp")
end if%>

查询处理代码:
<%dim strsql,conn,rs,aa
aa=request.form("chaxun")
if aa="name" then
strsql="select * from s124 where sno='"&request.form("name")&"'"
end if
set conn=server.createobject("adodb.connection")
conn.open "driver={sql server};database=dbuser;server=(local);uid=zfc2004;pwd=zfc2004"
set rs=server.createobject("adodb.recordset")
rs.open strsql,conn%>
<% while not rs.eof %> <font color="#800000"> </font>
<tr> <td><div align="center"><font size="2"><%=rs("sname")%></font></div></td></tr>
<% rs.movenext
wend%>

人数统计代码
<%strsql="select * from zfc2004.s12"
sconn="driver={sql server};server=(local);uid=zfc2004;pwd=zfc2004;database=dbuser"
set conn=server.createobject("adodb.connection")
conn.open sconn
set rst=server.createobject("adodb.recordset")
rst.open strsql,sconn,1,3
count=rst.recordcount%>
更新时间:<%=now%></font>)</p>
南昌大学(共<%=count%>人)</td>
<%rst.close
   strsql="select * from zfc2004.s12 where dept='软件学院'"  
   set rst=server.createobject("adodb.recordset")
   rst.open strsql,sconn,1,3
   countt=rst.recordcount %>
<td width="49%" rowspan="2" height="38">软件学院(共<%=countt%>人)</td>

返回列表

Powered by Discuz! 7.2   论坛QQ群:逐梦论坛群

© 2001-2021 Comsenz Inc. 鲁公网安备 37120302000001号