Public Function GetTables(con As ADODB.Connection, strTable() As String) As Boolean '函数:GetTables '功能:列出所有存在的表 '参数:strTable 要记录的表名 Dim cat As New ADOX.Catalog '数据库接入点 Dim tbl As New ADOX.Table '数据库的表 Dim i As Integer On Error Resume Next cat.ActiveConnection = con If err.Number <> 0 Then GoTo err1 ReDim strTable(0) As String For Each tbl In cat.Tables If tbl.Type = "TABLE" Then i = i + 1 ReDim Preserve strTable(i) As String strTable(i) = tbl.name End If Next If err.Number <> 0 Then GoTo err1 EnumTable = True Exit Function err1: err.Raise err.Number, "MyProj.MyObject", err.Description End Function Public Functio |
|