檢視重新整理方法範例 (VB)
下列程式代碼示範如何重新整理 CatalogViews 集合。 這是 必要條件,才能從 目錄 存取檢視 物件。
' BeginViewsRefreshVB
Sub Main()
On Error GoTo ProcedureViewsRefreshError
Dim cat As New ADOX.Catalog
' Open the catalog.
cat.ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='Northwind.mdb';"
' Refresh the Procedures collection.
cat.Views.Refresh
'Clean up
Set cat = Nothing
Exit Sub
ProcedureViewsRefreshError:
If Not cat Is Nothing Then
Set cat = Nothing
End If
If Err <> 0 Then
MsgBox Err.Source & "-->" & Err.Description, , "Error"
End If
End Sub
' EndViewsRefreshVB