当前位置: 首页 > 图文教程 > 网络编程 > ASP > 用Access制作一个功能完善的论坛(源程序)

ASP
ASP视频教程:后台页面加入限制访问和禁用缓存功能
ASP视频教程:制作网站前台首页
ASP视频教程:备份和还原SQL Server 2000数据库
ASP实例教程:asp无限级显示分类代码
IIS无法启动错误的几种情况汇总
asp Http_Referer,Server_Name和Http_Host
ASP 调用带参数输出的COM接口
隐藏修改文件时间和文件属性的ASP脚本
ASP Crazy 模版操作类(最简单的模板类、仅提供交流)
asp 动态数组 提供Add、Insert、Remove、RemoveAt、Search等方法。
asp 取一个数的整数 但不是四舍五入,只要有小数,就取大于这个数的整数
asp 判断上传文件中是否存在危险代码
asp 获取url函数小结
ASP 调用dll及封装dll实例
asp 实现的冒泡排序程序
asp 自定义分段函数/求第N名成绩
ASP 高级模板引擎实现类
ASP 常见的连接字符串写法(access2007)
ASP向Excel导数据(图片)终结版 ASP操作Excel
ASP实现防止网站被采集代码

ASP 中的 用Access制作一个功能完善的论坛(源程序)


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

  To view a live demonstration of this forum, click View Demo.
To create this forum on your server, you will need to create a Microsoft Access Database named
discuss.mdb. You will also need to create a single table in this database named messages that has the
following fields:

m_id -- An autonumber field
m_email -- A text field
m_subject -- A text field
m_message -- A Memo field
m_entrydate -- A Date/Time field with default value of NOW()
m_numReplies -- A Number field with default value of 0
m_reply -- A Number field with default value of -1




Listing 1.0 - discuss.asp

-----------------------------------
<html>
<head><title>Discussion</title></head>
<frameset rows="30,*">
<frame frameborder="no" scrolling="no" src="discusslogo.asp" marginheight=2 marginwidth=5>
<frame name="topframe" src="discussframes.asp">
</frameset>
</html>
-----------------------------------------









Listing 2.0 - discussframes.asp
-------------------------------------------------
<!-- #INCLUDE FILE="discussfuncs.asp" -->
<%
page = TRIM( request( "pg" ) )
addm = TRIM( request( "addm" ) )
email = TRIM( request( "email" ) )
subject = TRIM( request( "subject" ) )
message = TRIM( request( "message" ) )

IF addm <> "" THEN
IF email = "" THEN
showError "You did not enter your email address", "post.asp"
END IF
IF subject = "" THEN
showError "You did not enter a subject for your message", "post.asp"
END IF
IF message = "" THEN
showError "You did not enter a message", "post.asp"
END IF
IF INSTR( email, "." ) = 0 OR INSTR( email, "@" ) = 0 THEN
showError "You did not enter a valid email address", "post.asp"
END IF


readyDBCon
Set RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.CursorType = adOpenStatic
RS.LockType = adLockOptimistic
RS.Open "SELECT * FROM messages WHERE 1<>1", Con
RS.AddNew
RS( "m_email" ) = email
RS( "m_subject" ) = subject
RS( "m_message" ) = message
RS( "m_reply" ) = addm
RS.Update
RS.Close
IF addm <> "-1" THEN
Con.Execute "UPDATE messages SET m_numreplies = m_numreplies+1 WHERE m_id=" & addm
END IF
END IF
%>
<html>
<head><title>frameset</title>
<frameset rows="300,*">
<frame marginheight="3" marginwidth="5" frameborder="no" scrolling="yes" src="messagelist.asp?
pg=<%=page%>">
<frame name="message" marginwidth="0" marginheight="0" frameborder="no" scrolling="auto"
src="message.asp?id=<%=addm%>&pg=<%=page%>">
</frameset>
</html>

------------------------------------------------------







Listing 3.0 - discussfuncs.asp
-------------------------------------------------------
<%
dbPath = "d:\discuss.mdb"
messagesApage = 5

''''''''''''''''''''
' Define Constants  
''''''''''''''''''''
adOpenStatic = 3
adLockOptimistic = 3


'''''''''''''''''''''''''''
' Declare Global Variables
'''''''''''''''''''''''''''
DIM Con


SUB readyDBCon
IF Con = "" THEN
Set Con = Server.CreateObject( "adodb.Connection" )
Con.Open &qu