t;
</form>
<%
end sub
''==================================================================构建创建表的SQL语句
sub create_table()
dim sql,i,primarykey
on error resume next
sql = "CREATE TABLE ["&request("table_name")&"] ("
for i = 1 to request("i")
sql = sql & "[" & request("field_name")(i) & "] " & request("field_type")(i)
if request("field_size")(i) <> "" then
sql = sql & "(" & request("field_size")(i) & ")"
end if
if request("null")(i) = "NOT_NULL" then
sql = sql & " not null"
end if
if request("autoincrement")(i) = "自动编号" then
sql = sql & " identity"
end if
if request("primarykey")(i) = "primarykey" then
primarykey = request("field_name")(i)
end if
''if primarykey <> "" then
sql = sql & ","
''end if
next
if primarykey<>"" then
sql=sql&" primary key (["&primarykey&"]) "
end if
sql = sql & ")"
sql = replace(sql,"()","") ''构建空表
response.redirect "?key=sql&sql=" & sql
end sub
''==================================================================修改表名或字段名 2006-09-08
sub reobj()
on error resume next
Dim mydb,mytable,tablename
tablename = request("tablename")
Set mydb = Server.CreateObject("ADOX.Catalog")
mydb.ActiveConnection = conn
if request("obj") = "field" then ''修改字段名
dim fieldsname,newfieldsname
fieldsname = request("fieldsname")
newfieldsname = request("newfieldsname")
Set mytable = Server.CreateObject("ADOX.Table")
Set mytable = mydb.Tables(tablename)
mytable.Columns(fieldsname).Name = newfieldsname
end if
if request("obj") = "table" then ''修改表名
dim newtablename
newtablename = request("newtablename")
mydb.Tables(tablename).Name = newtablename
end if
if err <> 0 then
echo err.description
echo "<input type=''button'' name=''ok'' value='' 返 回 '' onClick=''javascript:history.go(-1)''>"
exit sub
end if
if request("obj") = "field" then
response.Redirect "?key=view&table_name=" & tablename
else
response.Redirect "?key=view&table_name=" & newtablename
end if
end sub
''==================================================================查看表结构函数
sub view(table_name)
''table_name = 表名称
dim rs,sql,table,primary,primarykey,i,editstr,typs
on error resume next
table = table_name
Set primary = Conn.OpenSchema(adSchemaPrimaryKeys,Array(empty, empty, table))
if primary("COLUMN_NAME") <> "" then
primarykey = primary("COLUMN_NAME")
end if
primary.Close
Set primary = Nothing
%>
<script language="javascript">
function table_delete()
{
if (confirm("确认删除该记录吗? 该操作将不可撤销!!!"))
return