ADOX 2.7

Parameters Collection, Command Property Example (VB)

The following code demonstrates how to use the Command property with the Command object to retrieve parameter information for the procedure.

' BeginParametersVB
Sub ProcedureParameters()

   Dim cnn As New ADODB.Connection
   Dim cmd As ADODB.Command
   Dim prm As ADODB.Parameter
   Dim cat As New ADOX.Catalog

   ' Open the Connection
   cnn.Open _
      "Provider=Microsoft.Jet.OLEDB.4.0;" & _
      "Data Source=c:\Program Files\Microsoft Office\" & _
      "Office\Samples\Northwind.mdb;"

   ' Open the catalog
   Set cat.ActiveConnection = cnn

   ' Get the command object
   Set cmd = cat.Procedures("CustomerById").Command

   ' Retrieve Parameter information
   cmd.Parameters.Refresh
   For Each prm In cmd.Parameters
      Debug.Print prm.Name & ":" & prm.Type
   Next

End Sub
' EndParametersVB

See Also

ActiveConnection Property | Catalog Object | Command Property | Procedure Object | Procedures Collection

© 1998-2001 Microsoft Corporation. All rights reserved.