Parameters Collection

A Parameters collection contains all the Parameter objects of a Command object.


Properties

Count, Item

Methods

Append, Delete, Refresh

Remarks

A Command object has a Parameters collection made up of Parameter objects.

Using the Refresh method on a Command object's Parameters collection retrieves provider parameter information for the stored procedure or parameterized query specified in the Command object. The collection will be empty for providers that do not support stored procedure calls or parameterized queries.

If you have not defined your own Parameter objects and you access the Parameters collection before calling the Refresh method, ADO will automatically call the method and populate the collection for you.

You can minimize calls to the provider to improve performance if you know the names and properties of the parameters associated with the stored procedure or parameterized query you wish to call. Use the CreateParameter method to create Parameter objects with the appropriate property settings and use the Append method to add them to the Parameters collection. This lets you set and return parameter values without having to call the provider for the parameter information. If you are writing to a provider that does not supply parameter information, you must manually populate the Parameters collection using this method to be able to use parameters at all. Use the Delete method to remove Parameter objects from the Parameters collection if necessary.

To refer to a Parameter object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

command.Parameters.Item(0)
command.Parameters.Item("name")
command.Parameters(0)
command.Parameters("name")
command(0)
command("name")
command![name]

Applies To

Command

See Also

CreateParameter, Parameter