DB2ParameterCollection.Clear Method
Removes all items from the collection.
- Namespace:
IBM.Data.DB2
- Assembly:
IBM.Data.DB2
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
NotOverridable Public Sub Clear() Implements IList.Clear
[C#]
public void Clear();
[C++]
public: __sealed void Clear();
[JScript]
public function Clear();
- Implements:
- IList.Clear
Example
[Visual Basic, C#] The following example creates a DB2®ParameterCollection, adds instances of DB2Parameter to the collection, displays the names of its DB2Parameter objects, and clears the collection.
[Visual Basic]
Public Sub CreateDB2ParamColl(myCommand As DB2Command)
Dim myParamCollection As DB2ParameterCollection = myCommand.Parameters
myParamCollection.Add("EMPNO", DB2Type.Char)
myParamCollection.Add("PHOTO_FORMAT", DB2Type.VarChar)
myParamCollection.Add("PICTURE", DB2Type.Blob)
Dim myParamNames As String = ""
Dim i As Integer
For i = 0 To myParamCollection.Count - 1
myParamNames += myParamCollection(i).ToString() + ControlChars.Cr
Next i
MessageBox.Show(myParamNames)
myParamCollection.Clear()
MessageBox.Show(myParamCollection.Count)
End Sub 'CreateDB2ParamColl
[C#]
public void CreateDB2ParamColl(DB2Command myCommand)
{
DB2ParameterCollection myParamCollection = myCommand.Parameters;
myParamCollection.Add("EMPNO", DB2Type.Char);
myParamCollection.Add("PHOTO_FORMAT", DB2Type.VarChar);
myParamCollection.Add("PICTURE", DB2Type.Blob);
string myParamNames = "";
for (int i=0; i < myParamCollection.Count; i++)
myParamNames += myParamCollection[i].ToString() + "\n";
MessageBox.Show(myParamNames);
myParamCollection.Clear();
MessageBox.Show(myParamCollection.Count)
}