明輝手游網(wǎng)中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

另一種顯示文章系統(tǒng)的思路-2

[摘要]2.dele.asp <% wname=trim(Request.QueryString("name")) 'name為要刪除的文章對應(yīng)的文本文件 名"wz-n.asp" (n=0,1,2,...),同 時也是從數(shù)據(jù)庫中的wname字段得來 s...

2.dele.asp
<% wname=trim(Request.QueryString("name")) 'name為要刪除的文章對應(yīng)的文本文件 名"wz-n.asp" (n=0,1,2,...),同
時也是從數(shù)據(jù)庫中的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&"'" '刪除數(shù)據(jù)庫中文章信息
dbconn.execute(sql)
dbconn.close
thisfile = server.mappath(wname)
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists(thisfile) then
fs.DeleteFile thisfile,True ' 刪除對應(yīng)的文本文件"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得來的要具體顯示內(nèi)容的那篇文章的對應(yīng)的文本文件名
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
%>
---------------------------------------------------
(出處:熱點網(wǎng)絡(luò))