用Access制作一个功能完善的论坛(源程序)
您现在的位置: 学网 >> 网站开发 >> ASP教程 >> ASP实例 >> 正文
学网教程

原作者:用Access制作一个功能完善的论坛(源程序)

[ 来源:xue5.com | 作者:原作者 | 时间:2005-5-15 | 去论坛]
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><ti

1
学网·特别声明:
本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。本站所有文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题,请联系编辑人员Xababy#Gmail.com,我们尽快予以更正。
设为首页 - 收藏学网 - 关于学网 - RSS订阅 - 版权申明 - 友情链接 - 联系学网 - 网站地图 - 投稿学网
学网·2004-2008版权所有
© CopyRight 2004-2008 WwW.Xue5.CoM.Inc All Rights Reserved
合作、建议、联系::cainiaoo.cn#live.cn QQ:329700200,1103290

学网_致力于提供优质免费的电脑学习教程
陕ICP备05000834号