<%
Dim Conn,ConnStr,oCat,oTbl,Action
Const FileNameStr="test.asp"
Action=Trim(Request("Action"))
If Action="" then
%>
<html>
<head>
<title>更改表名</title>
<style type="text/css">
<!--
a { text-decoration: none; color: #333366 }
a:hover { text-decoration: underline }
body { font-size: 12px; background-color: #FFFFFF }
table { font: 12px Tahoma, Verdana; color: #000000 }
.border{BORDER-RIGHT: #0096CE 1px solid; BORDER-TOP: #0096CE 1px solid;
BORDER-LEFT: #0096CE 1px solid; WIDTH: 220px; BORDER-BOTTOM: #0096CE 1px solid; BACKGROUND-COLOR: #ffffff}
input { font: 12px Tahoma, Verdana; font-weight: normal; }
form { margin: 0; padding: 0}
-->
</style>
</head>
<body>
<form name='myform' method='post' action='<%=FileNameStr%>'>
<table cellpadding="2" cellspacing="2" border="0" class="border" align="center">
<tr align="center">
<td>数据库:<input name="DbPath" size="25" value="#Database.mdb" maxlength="100"></td></tr>
<tr align="center">
<td>旧表名:<input name="OldName" size="25" value="" maxlength="100"></td></tr><tr align="center">
<td>新表名:<input name="NewName" size="25" value="Cl_" maxlength="100"></td></tr>
<tr align="center"><td><input type=hidden name="Action" value="Change"><input type=submit value="更改"></td>
</tr></table></form></body></html>
<%
else
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(Trim(Request("DbPath")))
Set oCat=Server.CreateObject("ADOX.Catalog")
oCat.ActiveConnection = ConnStr
Set oTbl = Server.CreateObject("ADOX.Table")
Set oTbl = oCat.Tables(Trim(Request("OldName")))
oTbl.Name = Trim(Request("NewName"))
Set oCat = Nothing
Set oTbl = Nothing
Response.write "<a href='"& FileNameStr &"'>修改成功,返回</a>"
end if
%>