Test environment: WINXP + VB6
Add two list boxes and one button
'Reference Microsoft ADO ext.2.x for DLL and security
Dim cat as ADOX. Catalog
Dim CNN as ADODB. Connection
Dim TBL as ADOX. Table
Private sub commandementclick ()
On Error resume next
For each TBL in cat. Tables
'If it is an sqlserver database, it becomes 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 CNN = new ADODB. Connection
Set cat = new ADOX. Catalog
CNN. Open "provider = Microsoft. Jet. oledb.4.0; Data Source = F:/csdn_vb/database/Article. mdb"
'Cnn. Open "provider = sqloledb.1; persist Security info = false; user id = sa; initial catalog = northwind; Data Source = Yang"
Set cat. activeconnection = CNN
End sub
Private sub form_unload (cancel as integer)
Set cat = nothing
Set con = nothing
End sub
Private sub listmediaclick ()
Dim labels
Dim intfield as integer
List2.clear
Intfield = cat. Tables (list1.list (list1.listindex). Columns. Count
For I = 0 to intfield-1
Set keys = cat. Tables (list1.list (list1.listindex). Columns (I)
List2.additem metadata. Name & "& amp; consumer. Type & amp;" & amp; consumer. definedsize
Next
End sub