asp.net.ph

IDataParameterCollection Interface

System.Data Namespace


Collects all parameters relevant to a Command object and their mappings to DataSet columns, and is implemented by .NET data providers that access data sources.

IDataParameterCollection Interface Members

Collapse   Properties

Visibility Name Value Type Accessibility
public Item ( String parameterName ) Object [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
public Contains ( String parameterName ) Boolean
public IndexOf ( String parameterName ) Int32
public RemoveAt ( String parameterName ) Void

Classes that Implement IDataParameterCollection


Class Description
OleDbParameterCollection Collects all parameters relevant to an OleDbCommand and their respective mappings to DataSet columns.
SqlParameterCollection Collects all parameters relevant to an SqlCommand and their respective mappings to DataSet columns. This class cannot be inherited.

Remarks

The IDataParameterCollection interface allows an inheriting class to implement a Parameter collection. For more information about Parameter classes, see Using Stored Procedures with a Command. For more information about implementing .NET data providers, see Implementing a .NET Data Provider.

An application does not create an instance of the IDataParameterCollection interface directly, but initializes an instance of a class that inherits IDataParameterCollection.

Classes that inherit IDataParameterCollection must implement the inherited members, and typically define additional members to add provider-specific functionality. For example, the IDataParameterCollection interface defines one implementation of the RemoveAt method. In turn, the OleDbParameterCollection class inherits this method, and defines two additional overloads of RemoveAt.

Notes to Implementers: When you inherit from the IDataParameterCollection interface, you should implement the following constructor:


Item Description
PrvParameterCollection ( ) Initializes an empty PrvParameterCollection class.

Example

The following example initializes multiple instances of the derived class, SqlParameter, through the SqlParameterCollection within the SqlDataAdapter. These parameters are used to select data from the data source and place the data in the DataSet. This example assumes that a DataSet and an SqlDataAdapter have already been created with the appropriate schema, commands, and connection.

void AddSqlParameters ( ) {

   // ... create myDataSet and myDataAdapter ...
   myDataAdapter.SelectCommand.Parameters.Add
      ( "@CategoryName", SqlDbType.VarChar, 80 ).Value = "toasters";
   myDataAdapter.SelectCommand.Parameters.Add
      ( "@SerialNum", SqlDbType.Int ).Value = 239;
   myDataAdapter.Fill ( myDataSet );
}
  C# VB

Skip Navigation Links



Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph