使用ADOX方便的查詢表和字段

2021-03-31 08:56:29 字數 1358 閱讀 7821

測試環境

:winxp+vb6 新增

2個列表框,

1個按鈕

'引用微軟

ado ext.2.x for dll and security

dim cat as adox.catalog

dim **n as adodb.connection

dim tbl as adox.table

private sub ***mand1_click()

on error resume next

for each tbl in cat.tables '

如果是sqlserver

資料庫,則變成

if left(tbl.name, 3) <> "sys"

if left(tbl.name, 4) <> "msys" then

list1.additem tbl.name

end if

next

end sub

private sub form_load()

set **n = new adodb.connection

set cat = new adox.catalog

**n.open "provider=microsoft.jet.oledb.4.0;data source=f:/csdn_vb/database/article.mdb"

'**n.open "provider=sqloledb.1;persist security info=false;user id=sa;initial catalog=northwind;data source=yang"

set cat.activeconnection = **n

end sub

private sub form_unload(cancel as integer)

set cat = nothing

set con = nothing

end sub

private sub list1_click()

dim fld

dim intfield as integer

list2.clear

intfield = cat.tables(list1.list(list1.listindex)).columns.count

for i = 0 to intfield - 1

set fld = cat.tables(list1.list(list1.listindex)).columns(i)

list2.additem fld.name & " " & fld.type & " " & fld.definedsize

next

end sub

MYSQL查詢表的字段和表名

2 查詢mysql是否包含某張表 1 drop table ifexists tablename 2 做乙個sql查詢,比如 select from tablename select count from tablename,如果返回值為空,則表不存在。3 查詢 show tables like t...

SqlServer查詢表的字段和注釋

select case when a.colorder 1 then d.name else null end 表名,a.colorder 字段序號,a.name 欄位名,case when columnproperty a.id,a.name,isidentity 1 then else end ...

oracle 查詢所有表和字段

select from all tab comments 查詢所有使用者的表,檢視等 select from user tab comments 查詢本使用者的表,檢視等 select from all col comments 查詢所有使用者的表的列名和注釋.select from user co...