nathan schmoll's
aspdiscovery

back to main page

e-mail me








Building an article management system -- Part III
<< Go to back to part two

Welcome to the third part in a four-part tutorial on how to make an article management system utilizing the powerful database capabilities of Active Server Pages!

In this article I will discuss the ASP code that accesses the database and delivers an article. I will just show you all the code at once and then I will discuss every part of it.

<%
set db=server.createobject("ADODB.Connection")
db.open "Driver={Microsoft Access Driver (*.mdb)}; _
DBQ="&server.mappath("articles.mdb")&";"
query="SELECT * FROM articles"
set rs=db.execute(query)
WHILE NOT RS.EOF
id=rs("id")
if request("id")=id then
showvalidpage="1"
title=rs("title")
content=rs("content")
dateofpub=rs("date")
author=rs("author")
end if
rs.movenext
wend
if showvalidpage="1" then
%>
<html><head><title>Article: "<%=title%>"
</title><body><font face="tahoma,verdana,arial,helvetica">
<b><big><big><%=title%></big></big></b><br><small><small>Written by <b><%=author%></b><br>Published on <b><%=dateofpub%></b><br>(article id: <b><%=id%></b>)<br><br></small></small><%=content%></b></font></body></html>
<%
else
%>
<font face="tahoma,verdana,arial,helvetica"><b>Sorry, but the article you requested does not exist.</b></font>
<%
end if
%>

In the next article I will walk through every part of the "article.asp" script and how it functions. I will also show you how to implement it into your own site.

Go to next to part four >>

copyright © 2001, nathan schmoll. all rights reserved. questions? comments? suggestions? e-mail me!