<%
'############################### #####
'replace the database content with lamking
'update and fix:
'HTTP: // www.imbbs.cn QQ: 628557
'sale space domain name. Create a Web page.
'####################################
'modify the following according to your situation
const S1 = "admin" 'string to be replaced
replace const S2 = "1234"' string
const DB = "lamking. mdb "'database
const ignorecase = true' case-insensitive
'the following data does not need to be changed
dim ors, ors2, Conn, I
set conn = server. createobject ("ADODB. connection ")
Conn. open "provider = Microsoft. jet. oledb.4.0; Data Source = "& server. mappath (db)
set ors = Conn. openschema (20)
do while not ORS. EOF
If ucase (ORS ("table_type ")) = "table" then' if it is a user table
', each field of the table is replaced cyclically.
set ors2 = server. createobject ("ADODB. recordset ")
ors2.open" select * from ["& Ors (" table_name ") &"] ", Conn, 1, 3
do while not ors2.eof
for I = 0 to ors2.fields. count-1
'if it is an OLE object or an automatically numbered field, it is not replaced.
If ors2 (I ). properties ("isautoincrement") = false and ors2 (I ). type <> 205 then
ors2 (ors2 (I ). name) = myreplace (ors2 (I ). value)
end if
Next
Ors2.update
Ors2.movenext
Loop
Ors2.close
Set ors2 = nothing
End if
ORS. movenext
Loop
ORS. Close
Set ors = nothing
Conn. Close
Set conn = nothing
Response. Write "replaced"
Function myreplace (byval tstr)
Dim RegEx
If tstr = "" Or isnull (tstr) Then exit function
Set RegEx = new Regexp
RegEx. Global = true
RegEx. ignorecase = ignorecase
RegEx. multiline = true
RegEx. pattern = S1
Myreplace = RegEx. Replace (tstr, S2)
Set RegEx = nothing
End Function
%>