当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP进阶之文章在线管理更新(6)

ASP
ASP下经常用的字符串等函数参考资料
asp下连接数据库 ASP链接数据库字符串大全总结
asp内置对象 ObjectContext 事务管理 详解
asp 内置对象 Application 详解
ASP中 SQL语句 使用方法
ASP 中 Split 函数的实例分析
ASP 中 DateDiff 函数详解 主要实现两日期加减操作
asp 存贮过程 (SQL版asp调用存储过程)
利用ASP实现在线生成电话图片效果脚本附演示
使用ASP记录在线用户的数量的代码
关于ASP生成伪参数技巧 简洁实用的伪(僞)参数
asp 关键词字符串分割如何实现方法
用ASP编写的加密和解密类
ASP之处理用Javascript动态添加的表单元素数据的代码
asp下最常用的19个基本技巧
一些Asp技巧和实用解决方法
asp实现一个统计当前在线用户的解决方案
asp下的一个很简单的验证码程序
asp又一个分页的代码例子
asp实现防止从外部提交数据的三种方法

ASP进阶之文章在线管理更新(6)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 233 ::
收藏到网摘: n/a

  ASP进阶之文章在线管理更新--文章显示篇

作者:沙滩小子

  前面已经为大家介绍了文章的添加保存,接下来就应该讲讲文章的显示了。在这里,你更加可以看出ASP的简单易用性,仅仅是通过一个文件,就可以对数据库内的所有文章进行显示。它主要是通过从连接返回的文章号(articleid)和栏目的信息(typeid)来打开数据库中指定的记录以及指定显示所需要的内容。

  以下是文章显示页面(list.asp)的详细代码以及注解:

  "打开数据库连接
<!--#include file="conn.asp"-->
<html>
<%
  "定义变量
dim sql
dim rs
dim typename
dim typeid
dim rstype,typesql
  "接受返回的栏目信息并打开指定栏目记录集type
typeid=request("typeid")
set rstype=server.createobject("adodb.recordset")
  typesql="select * from type where typeID="&cstr(typeid)
  rstype.open typesql,conn,1,1
  "调用指定栏目名称并将其信息指定给typename
  typename=rstype("type")
  "关闭记录集
  rstype.close
%>
<head>
<title>ASP动网先锋|http://asky.on.net.cn</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div align="center"><center>

<table border="1" width="97%" cellspacing="0" cellpadding="0" bordercolorlight="#000000"
bordercolordark="#FFFFFF">
  <tr>
    <td width="100%" bgcolor="#D0D0D0"><p align="center">
  "显示栏目信息
 栏目:<%=typename&%>
<%
  "打开指定记录集article,并通过返回的文章号id打开指定文章号的相关内容,在这里显示了文章号,加入日期,浏览数,文章标题以及文章内容
set rs=server.createobject("adodb.recordset")
sql="select * from artidle where articleid="&request("id")
rs.open sql,conn,1,1
%>
----文章编号:<%=rs("articleid")%>----加入日期:<%=rs("date")%>----浏览数:<%=rs("hits")%></td>
  </tr>
  <tr>
    <td width="100%"><p align="right"><a href="javascript:self.close()">『关闭窗口』</a></td>
  </tr>
  <tr>
    <td width="100%"><p align="center"><b><%=rs("title")%></b></td>
  </tr>
  <tr>
    <td width="100%">
    <blockquote>
      <br>
<%=rs("content")%>      <br>
      <br>
<p align=center>
  "这里是文章的EMAIL转发,通过一段sentemail程序来实现,下面将为大家介绍
<form method=Post action='sentemail.asp?id=<%=rs("articleid")%>'>
<b>发送文章到邮箱</b><br>
<input type='text' name='email' maxlength=20 class=smallInput>
  <input class=buttonface type='submit'  value='发送'  name='send'>
</form>
    </blockquote>
   </td>
  </tr>
</table>
</center></div>
</body>
</html>
<%
  "关闭记录集和数据库连接
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

  以上就是文章的显示程序,在这里以一段很少的代码就实现了从数据库调用指定文章内容以及显示的过程,相信到这里你更能体会到ASP的功用了,在本节中提到了利用ASP在线发送文章到信箱的程序,那么下面我将为大家介绍关于文章转发邮箱功能!