另一种显示文章系统的思路-2

发表于:2007-06-30来源:作者:点击数: 标签:
2.dele.asp % wname=trim(Request.QueryString(name)) ‘’name为要删除的文章对应的文本文件 名wz-n.asp (n=0,1,2,...),同 时也是从 数据库 中的wname字段得来 set dbconn=server.createobject(adodb.connection) conpath=DBQ= server.mappath(wzozg.mdb) db
2.dele.asp
<% wname=trim(Request.QueryString("name")) ‘’name为要删除的文章对应的文本文件 名"wz-n.asp" (n=0,1,2,...),同
时也是从数据库中的wname字段得来
set dbconn=server.createobject("adodb.connection")
conpath="DBQ=" &server.mappath("wzozg.mdb")
dbconn.Open "DRIVER={Microsoft Aclearcase/" target="_blank" >ccess Driver (*.mdb)}; " & conpath
sql="delete from ozg where wname=‘’"&wname&"‘’" ‘’删除数据库中文章信息
dbconn.execute(sql)
dbconn.close
thisfile = server.mappath(wname)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(thisfile) then
fs.DeleteFile thisfile,True ‘’ 删除对应的文本文件"wz-n.asp"
end if
Set fs=nothing
%>
3.showwz.asp
<% set dbconn=server.createobject("adodb.connection")
conpath="DBQ=" &server.mappath("../../db/wzozg.mdb")
dbconn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & conpath
set rs=server.createobject("adodb.recordset")
rs.open sql,dbconn,3,1
number=rs.recordcount%> ‘’把所有文章一般信息读入记录集rs中
%>
4.wz.asp
<%wname=Request.QueryString("wname") ‘’从showwz.asp得来的要具体显示内容的那篇文章的对应的文本文件名
set dbconn=server.createobject("adodb.connection")
conpath="DBQ=" &server.mappath("wzozg.mdb")
dbconn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & conpath
sql="update ozg set wcount=wcount+1 where wname="&wname&""
dbconn.Execute(sql)
sql="select wauth,wname,wcontent,wsource,wauth from ozg where wid="&id&""
set rs=dbconn.Execute(sql) ‘’把要显示的那篇文章一般信息读入记录集中
filename = server.mappath(wname)
rs.close
dbconn.Close
Set fs=CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(filename,1,False)
do while not thisfile.AtEndOfStream
thisline = thisfile.readline
if thisline<>"" then
thisline=server.HTMLENCODE(thisline)
response.write"<p>‘’"&thisline&"‘’</p>"
end if
loop
thisfile.close
set fs=nothing
%>
---------------------------------------------------
writen by aspboy and powered by http://easp.126.com

原文转自:http://www.ltesting.net