请大家帮忙,谢谢!
请大家帮忙,谢谢!
这个函数或许能帮上你的忙 [QUOTE]Private Sub Command1_Click() '功能:获取access库中表的个数及表的名称 '用ado怎样实现 '工程--->引用--->Microsoft ActiveX Data Object 2.x(版本号) '---------------------------------------------------------------------------- Dim adoCN As New ADODB.Connection '定义数据库的连接 Dim strCnn As New ADODB.Recordset Dim rstSchema As New ADODB.Recordset Dim i As Integer str1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\db1.MDB;Persist Security Info=False" adoCN.Open str1
Set rstSchema = adoCN.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF If rstSchema!TABLE_TYPE = "TABLE" Then out = out & "Table name: " & _ rstSchema!TABLE_NAME & vbCr & _ "Table type: " & rstSchema!TABLE_TYPE & vbCr i = i + 1 End If rstSchema.MoveNext Loop MsgBox i & " 个表" rstSchema.Close
adoCN.Close Debug.Print out End Sub[/QUOTE]