欢迎光临
我们一直在努力

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

建站超值云服务器,限时71元/月

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 access 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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 另一种显示文章系统的思路-2
分享到: 更多 (0)