搜索文章:

首页  |  Java技术  |  Asp.net  |  Asp编程  |  VC/C++  |  Delphi  |  VB编程

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

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

()

相关文章:
© 2006   www.java-asp.net