自己可以修改myreplace函数,实现复杂的替换.呵呵,好象用处不大.主要是看看如何读取access表和字段列表
<%
####################################
替换数据库内容 lamking 2005-8-22
http://www.lamking.com qq:628557
####################################
dim db,connstr,conn,rs,rs2,str1,str2,i
str1=”abcd” 要替换的字符串
str2=”1234″ 替换为的字符串
db=”lamking.mdb”
set conn=server.createobject(“adodb.connection”)
connstr=”provider=microsoft.jet.oledb.4.0;data source=”&server.mappath(db)
conn.open connstr
set rs = conn.openschema(20)
do while not rs.eof
if rs(“table_type”)=”table” then
set rs2=server.createobject(“adodb.recordset”)
rs2.open “select * from [“&rs(“table_name”)&”]”,conn,1,3
do while not rs2.eof
for i=0 to rs2.fields.count-1
if rs2(i).properties(“isautoincrement”) = false then
rs2(rs2(i).name)=myreplace(rs2(i).value)
end if
next
rs2.movenext
loop
rs2.close
set rs2=nothing
end if
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write”替换完成”
function myreplace(byval tstr)
if tstr=”” or isnull(tstr) then
exit function
else
myreplace=replace(tstr,str1,str2)
end if
end function
%>