如题……
SQL语句:
select * from sysobjects where type=U
逍遥浪子编程
网志:http://blog.csdn.net/xiaoyaolz
交个朋友,一起编程,学习,一生的朋友
Function ListTable(Optional gettype As String = "TABLE") As String TABLE或VIEW,SYNONYM(链接表)id=111
On Error GoTo err
Dim doerr As Boolean
Dim I
Dim TableSet As ADODB.Recordset
Dim a adSchemaTables
adSchemaPrimaryKey
If StrConv(gettype, vbLowerCase) = "all" Then
Set TableSet = conn.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty))
Else
Set TableSet = conn.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, gettype))
End If
类型:[" & TableSet("table_type") & "] " & TableSet("table_name")
Do Until TableSet.EOF
I = I + 1
If TableSet("table_name") <> "" Then
a = a & vbCrLf & TableSet("table_name")
高级型a = a & vbCrLf & "类型:[" & TableSet("table_type") & "] " & TableSet("table_name")
End If
TableSet ("table_name") & vbCrLf
TableSet.MoveNext
Loop
ListTable = a
a = ""
I = 0
检查是否打开数据库
Exit Function
err:
If Not doerr Then
doerr = True
If err.Number = 91 Then
openconn
Resume
End If
End If
err.Clear
End Function