access| Data | database | string
You can modify the Myreplace function to achieve complex substitutions. Oh, it seems to be of little use. Mainly to see how to Read Access tables and field lists
<%
'####################################
' Replace database content lamking 2005-8-22
' Http://www.lamking.com qq:628557
'####################################
Dim Db,connstr,conn,rs,rs2,str1,str2,i
str1= "ABCD" ' String to replace
str2= "1234" replaced with a string
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 as 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 as 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 "Replace Complete"
Function Myreplace (ByVal tstr)
If tstr= "" Or isnull (TSTR) Then
Exit Function
Else
Myreplace=replace (TSTR,STR1,STR2)
End If
End Function
%>