0
我已經使用此代碼鏈接到表格中,但我試圖將其更改爲View
並且沒有鏈接,即使滿足條件。我應該改變什麼來鏈接視圖?使用前綴鏈接所有視圖
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim f As ADODB.Field
Dim conn As String
Set c = New ADODB.Connection
With c
.Provider = "sqloledb.1"
With .Properties
.Item("Data Source") = "Server"
.Item("Initial Catalog") = "database"
.Item("PassWord") = "user"
.Item("User ID") = "pass"
End With
.Open
Set r = .OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
With r
While Not .EOF
'Table_Type = Table works
If (.Fields("TABLE_TYPE") = "View" And .Fields("TABLE_NAME") Like "ZZ_*") Then
'Do something
End If
.MoveNext
Wend
End With