当前位置: 首页 > 图文教程 > 网络编程 > ASP > 简单ASP论坛DIY

ASP
ASP中一个字符串处理类
获取软件下载的真实地址!再谈获取Response.redirect重定向的URL
【先锋海盗类】Ver2005 最终版
CacheCls缓存的应用
用ASP应用程序实现自己的UrlDeCode
[原创]asp截取字符串的两种应用
蓝色空间 天气小偷
内容分页函数
创力采集程序用到的函数 推荐
用ASP和SQL实现基于Web的事件日历
FSO操作文件系统
用数据库生成不重复的流水号
asp编译成dll-图形化教程
NextRecordset 和 GetRows 双簧合奏
asp中通过getrows实现数据库记录分页的一段代码
网站生成静态页面,及网站数据采集的攻、防原理和策略
ASP开发中数据库文件调用的捷径
两个小函数让你的ASP程序对SQL注入免疫!
利用Microsoft.XMLHTTP控件发送COOKIE
ASP的天空小偷

简单ASP论坛DIY


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

首先用Access新建一个数据库,设取名为luntan,数据表的名称为“information”,建立如下字段:“text”,“name”,“time”,并将“time”默认值设为Now()

以下为引用的内容:
<%

  Set com = Server.CreateObject("ADODB.Connection")

  com.open"DRIVER={Microsoft Access Driver("luntan.mdb");

pwd=information;DBQ="&Server.MapPath("luntan.mdb")

  sql="select*from information order by time Desc"

  Set rs=Server.CreateObject("ADODB.Recordest")

  rs.open sql,com,3,2

  if rs.EOF or rs.BOF then

  response.write"没有留言"

  else

    rs.MoveFirst

    while Not rs.EOF.

          response.write rs("name")&"发布于"&rs("time")&"<br>"

        response.write rs("text")&"<br><hr>"

       rs.MoveNext

  wend

AbsolutePosition=N,(N=1,2,3......)

  end if

  %>

接着是用户书写留言部分。设论坛页为“information.asp”,则

  <form method=post action="information.asp">

  姓名:<input type=text size=12 name="name"><br>

  留言:<textarea cols=30 row=4 name="text"></textarea><br>

  <input type=submit value="提交">

  </form>

最后一部分是将用户提交的表单数据记录到数据库中,则

以下为引用的内容:
 <%
  if request("text")<>empty and request ("name")<>empty then

  Set comb=Server.CreateObject("ADODB.Connection")

  comb.Open"DRIVER={Microsoft Access Driver(*.mdb)};pwd=information;

DBQ="&Server.MapPath("luntan.mdb")

  sql="select*from information"

  Set rsb=Server.CreateObject("ADODB.Recordset")

  rsb.open sql,comb,3,2

  rsb.AddNew

  rsb("text")=request("text")

  rsb("name")=request("name")

  rsb.update

  end if
%>