Views, exemple de méthode Append (VB)
Le code suivant montre comment utiliser un objet Command et la méthode Append de la collection Views pour créer une vue dans la source de données sous-jacente.
' 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
Voir aussi
ActiveConnection, propriété (ADOX)
Append, méthode (vues ADOX)
Catalog, objet (ADOX)
View, objet (ADOX)
Views, collection (ADOX)
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour