set rs = con.OpenSchema(adSchemaTables) do while not rs.eof if rs("table_type") = "TABLE" then tablename= rs("table_name") '得到表名 end if rs.movenext loop rs.closeset rs = con.OpenSchema(adSchemaTables) do while not rs.eof if rs("table_type") = "VIEW" then tablename= rs("table_name") '得到视图 end if rs.movenext loop rs.close
do while not rs.eof
if rs("table_type") = "TABLE" then
tablename= rs("table_name") '得到表名
end if
rs.movenext
loop
rs.closeset rs = con.OpenSchema(adSchemaTables)
do while not rs.eof
if rs("table_type") = "VIEW" then
tablename= rs("table_name") '得到视图
end if
rs.movenext
loop
rs.close
上面的adSchemaTables是一个常量为20
在最前面加上adSchemaTables=20
con是数据库连接对象
自己写连接啦
上面的程序是用程序得到