盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

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

时间:2024/9/12作者:未知来源:盾怪网教程人气:

[摘要]2.dele.asp <% wname=trim(Request.QueryString("name")) 'name为要删除的文章对应的文本文件 名"w...

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
%>
---------------------------------------------------
(出处:热点网络)

关键词:另一种显示文章系统的思路-2




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版