ASP批量更新代碼
更新時(shí)間:2008年03月08日 23:38:42 作者:
我作了一個(gè)ASP靜態(tài)站,由于網(wǎng)站改片,所以所有靜態(tài)頁(yè)都要更新,原來(lái)是以時(shí)間命名為文件命,現(xiàn)在全部改成ID命名,但數(shù)據(jù)庫(kù)內(nèi)的保存地址的那個(gè)字段無(wú)法更新,請(qǐng)各位大蝦指點(diǎn)一二,小弟不勝感激...................
<!--#include file="../Conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from article where bigtypes='我愛(ài)你'order by id desc" 找出數(shù)據(jù)庫(kù)內(nèi)類(lèi)別為我愛(ài)你的所有數(shù)據(jù)
rs.open sql,conn,1,3
if not rs.eof then
do while not rs.eof
fname = rs("id")&".html"
folder = "../html/Info/"
c_filepath = folder&fname
rs("filepath")=c_filepath
rs.update
rs.movenext
loop
end if
response.redirect "成功....."
%>
解決方法:
<%
set rs=server.createobject("adodb.recordset")
sql="select * from article where bigtypes='我愛(ài)你'order by id desc" 找出數(shù)據(jù)庫(kù)內(nèi)類(lèi)別為我愛(ài)你的所有數(shù)據(jù)
rs.open sql,conn,1,3
if not rs.eof then
do while not rs.eof
fname = rs("id")&".html"
folder = "../html/Info/"
c_filepath = folder&fname
conn.execute("update article set filepath='"&c_filepath&"' where id="&rs("id"))
rs.movenext
loop
end if
response.redirect "成功....."
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from article where bigtypes='我愛(ài)你'order by id desc" 找出數(shù)據(jù)庫(kù)內(nèi)類(lèi)別為我愛(ài)你的所有數(shù)據(jù)
rs.open sql,conn,1,3
if not rs.eof then
do while not rs.eof
fname = rs("id")&".html"
folder = "../html/Info/"
c_filepath = folder&fname
rs("filepath")=c_filepath
rs.update
rs.movenext
loop
end if
response.redirect "成功....."
%>
解決方法:
復(fù)制代碼 代碼如下:
<%
set rs=server.createobject("adodb.recordset")
sql="select * from article where bigtypes='我愛(ài)你'order by id desc" 找出數(shù)據(jù)庫(kù)內(nèi)類(lèi)別為我愛(ài)你的所有數(shù)據(jù)
rs.open sql,conn,1,3
if not rs.eof then
do while not rs.eof
fname = rs("id")&".html"
folder = "../html/Info/"
c_filepath = folder&fname
conn.execute("update article set filepath='"&c_filepath&"' where id="&rs("id"))
rs.movenext
loop
end if
response.redirect "成功....."
%>
您可能感興趣的文章:
相關(guān)文章
從文本文件中讀取信息并存儲(chǔ)入數(shù)據(jù)庫(kù)
從文本文件中讀取信息并存儲(chǔ)入數(shù)據(jù)庫(kù)...2006-12-12
asp中最新新聞顯示new圖片的實(shí)現(xiàn)代碼
很多朋友想在最新新聞顯示new圖片,以便訪(fǎng)客快速找到新更新的內(nèi)容,原理就是通過(guò)判斷日期2012-03-03
ASP隱藏真實(shí)文件的下載功能實(shí)現(xiàn)代碼
將下邊的文件保存為Download.asp就可以了,然后根據(jù)需要傳要下載的文件過(guò)來(lái)就可以了。2008-12-12
ASP獲取網(wǎng)頁(yè)全部圖片地址并保存為數(shù)組的正則
ASP常用函數(shù):getIMG()獲取網(wǎng)頁(yè)全部圖片地址并保存為數(shù)組2008-03-03
asp實(shí)現(xiàn)樹(shù)型結(jié)構(gòu)
asp實(shí)現(xiàn)樹(shù)型結(jié)構(gòu)...2007-03-03

