[求助]如何用VB6取得ACCESS中的所有表的名称
如何用VB6取得ACCESS中的所有表的名称
vb6能不能做到呀!请大侠门指点!
Option Explicit
Private Sub Command1_Click()
Dim conString As String
conString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=d:\mdb\Northwind.mdb"
Dim dbConn As New ADODB.Connection
dbConn.CursorLocation = adUseClient
Dim Rst As ADODB.Recordset
dbConn.Open conString
Set Rst = dbConn.OpenSchema(adSchemaTables)
Dim i As Long
For i = 0 To Rst.RecordCount - 1
If Rst.Fields("TABLE_TYPE") = "TABLE" Then
Print Rst.Fields("TABLE_NAME").Value
End If
Rst.MoveNext
Next
Rst.Close
dbConn.Close
Set dbConn = Nothing
End Sub