Views Append Method Example (VB)
The following code demonstrates how to use a Command object and the Views collection Append method to create a new view in the underlying data source.
' BeginCreateViewVB
Sub Main()
On Error GoTo CreateViewError
Dim cmd As New ADODB.Command
Dim cat As New ADOX.Catalog
' Open the Catalog
cat.ActiveConnection = _
"Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='Northwind.mdb';"
' Create the command representing the view.
cmd.CommandText = "Select * From Customers"
' Create the new View
cat.Views.Append "AllCustomers", cmd
'Clean up
Set cat.ActiveConnection = Nothing
Set cat = Nothing
Set cmd = Nothing
Exit Sub
CreateViewError:
Set cat = Nothing
Set cmd = Nothing
If Err <> 0 Then
MsgBox Err.Source & "-->" & Err.Description, , "Error"
End If
End Sub
' EndCreateViewVB
See Also
ActiveConnection Property (ADOX)
Append Method (ADOX Views)
Catalog Object (ADOX)
View Object (ADOX)
Views Collection (ADOX)
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho