Represents a collection of parameters relevant to a DB2Command as well as their mappings to columns in a DataSet.
System.Object
System.MarshalByRefObject
System.Data.Common.DbParameterCollection
IBM.Data.DB2.DB2ParameterCollection
[Visual Basic]
NotInheritable Public Class DB2ParameterCollection
Inherits DbParameterCollection
Implements IDataParameterCollection, IList, ICollection, _
IEnumerable
[C#]
public sealed class DB2ParameterCollection : DbParameterCollection,
IDataParameterCollection, IList, ICollection, IEnumerable
[C++]
public __gc __sealed class DB2ParameterCollection : public
DbParameterCollection, IDataParameterCollection, IList,
ICollection,
IEnumerable
[JScript]
public class DB2ParameterCollection extends DbParameterCollection
implements IDataParameterCollection, IList, ICollection,
IEnumerable
Exception type | Condition |
---|---|
DB2Exception | Wrong number of parameters. The number of parameters in the collection must be equal to the number of parameter placeholders within the command text. |
[Visual Basic, C#] The following example assumes the existence of a table named MyTable and a stored procedure named MyProcedure. These objects are defined with the following statements:
create table MyTable (column1 int)
create procedure MyProcedure (p1 int ) language sql LABEL1:
begin insert into MyTable values (p1); end
The example calls the MyProcedure stored procedure.
[Visual Basic]
Public Sub AddDB2Parameters()
// Create myConnection and myCommand.
myCommand.CommandText = "{call MyProcedure (?)}"
myCommand.Parameters.Add("p1",DB2Type.Integer).Value = 100
myCommand.ExecuteNonQuery()
End Sub 'AddDB2Parameters
[C#]
public void AddDB2Parameters()
{
// Create myConnection and myCommand.
myCommand.CommandText = "{call MyProcedure (?)}";
myCommand.Parameters.Add("p1",DB2Type.Integer).Value = 100;
myCommand.ExecuteNonQuery();
}
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.