如何批量修改ACCESS数据表名
<%oConnStr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\www.\data\data.mdb"
Sub RenameTable (oldName, newName)
Dim objADOXDatabase
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
objADOXDatabase.ActiveConnection = oConnStr
objADOXDatabase.Tables(oldName).Name = newName
Set objADOXDatabase = Nothing
End Sub
'Sub DBConnBegin()
Set oConn=server.CreateObject("adodb.Connection")
oConn.Open oConnStr
If Err.Number>0 Then
Response.End
End If
Const adSchemaTables = 20
adSchemaColumns = 4
Set rstSchema = oConn.OpenSchema(adSchemaColumns)
tablename=""
Do Until rstSchema.EOF
If rstSchema("Table_name")<>tablename then
tablename = rstSchema("Table_name")
response.write tablename & "<BR>"
If InStr(LCase(tablename),"oldname")>0 then
tablename1=Replace(LCase(tablename),"oldname","Xiya_")
Call RenameTable(tablename, tablename1)
End If
end if
rstSchema.MoveNext
Loop
%>
这是网上找的代码,如何利用啊?我怎么修改不成功呢!