在线数据库管理工具(db007) v1.5(33)
if strt = "2" then
echo "以下是 <font color=red> 数据库 </font> 的结构: "
echo "<input type='button' name='ok' value=' 返 回 ' onClick='javascript:history.go(-1)'>"
set objSchema = Conn.OpenSchema(adSchemaTables)
Do While Not objSchema.EOF
if objSchema("TABLE_TYPE") = "TABLE" then
table = objSchema("TABLE_NAME")
strsql = strsql & getsql(table)'table & "|"'getsql(table)
end if
objSchema.MoveNext
Loop
objSchema.close
end if
echo "<textarea cols=110 rows=38>" & strsql & "</textarea>"
conn.close
end sub
'================================================================== 输出表结构
function getsql(table)
on error resume next
getsql = "-- 表结构 " & table & " 的SQL语句。" & chr(10)
dim primary,primarykey
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
tbl_struct = "CREATE TABLE [" & table & "] ( " & chr(10)
sql = "SELECT * FROM " & table
Set rs = Conn.Execute(sql)
if err = 0 then
for i = 0 to rs.fields.count-1
tbl_struct = tbl_struct & "[" & rs(i).name & "] "
内容版权声明:除非注明,否则皆为本站原创文章。