DBTables

Returns an array of all table names in a database. needs valid OLE database connection string

CodeFunctionName
What is this?

Public

Tested

Original Work
Function DBTables(connstring, ANStrArray, Sepa_Col)
    ' Returns array (or ANStrArray seperated by Sepa_Col)
    '    ANStrArray = 1 to return string with Sepa_Col
    '        Otherwise will return an array
    Dim adox, i, strTables
    Set adox = Server.CreateObject("ADOX.Catalog")
    adox.ActiveConnection = connstring
    for i = 0 to adox.tables.count - 1
        if UCase( adox.tables(i).type ) = "TABLE" then
            strTables = strTables & adox.tables(i).name & vbCrLf
        end if
    next
    Set adox = nothing
    If ANStrArray = 1 Then
        DBTables = Replace(strTables, vbcrlf, Sepa_Col)
    Else
        DBTables = split( strTables, vbCrLf )
    End If
End Function

byval connstring, ANStrArray, Sepa_Col

Views 105

Downloads 13

CodeID
DB ID

ANmarAmdeen
591
Attachments
Revisions

v1.0

Thursday
April
28
2022