添加个列表框个按钮 引用微软 ADO ExtX for dll and Security Dim cat As ADOXCatalog Dim cnn As ADODBConnection Dim tbl As ADOXTable Private Sub Command_Click() On Error Resume Next For Each tbl In catTables 如果是sqlserver数据库则变成If Left(tblName ) <> sys If Left(tblName ) <> MSys Then ListAddItem tblName End If Next End Sub Private Sub Form_Load() Set cnn = New ADODBConnection Set cat = New ADOXCatalog cnnOpen Provider=MicrosoftJetOLEDB;Data Source=F:\csdn_vb\database\articlemdb cnnOpen Provider=SQLOLEDB;Persist Security Info=False;User ID=sa;Initial Catalog=northwind;Data Source=yang Set catActiveConnection = cnn End Sub Private Sub Form_Unload(Cancel As Integer) Set cat = Nothing Set con = Nothing End Sub Private Sub List_Click() Dim fld Dim intfield As Integer ListClear intfield = catTables(ListList(ListListIndex))ColumnsCount For i = To intfield Set fld = catTables(ListList(ListListIndex))Columns(i) ListAddItem fldName & & fldType & & fldDefinedSize Next End Sub |