Databases Reference
In-Depth Information
VB.NET
Public Property Value() As Object _
Implements IDataParameter.Value
Get
Return m_value
End Get
Set(ByVal Value As Object)
m_value = Value
End Set
End Property
Creating the DataSetParameterCollection Class
The
DataSetParameterCollection
class is simply a collection of parameter objects. Although you
could have created a custom collection class that implements all of the required methods, an easier route
exists. The
IDataParameterCollection
interface is basically a subset of the
IList
interface used to
define other objects in the .NET Framework. By using an object already available, you reduce the
required coding effort considerably.
To add the
DataSetParameterCollection
class to the project, choose Project
➪
Add Class from the
menu. Change the name of the class to
DataSetParameterCollection
.
There is no need to create custom constructors or member variables for use in your collection class. This
is because you can use the internal variables and constructors that exist inside the
ArrayList
base class
that this class inherits from. The properties that you create will be mapped directly to properties and
methods that exist in the
ArrayList
class.
Namespaces
The
DataSetParameterCollection
class uses the standard namespaces discussed earlier. There is an
additional namespace that is needed because of the use of
ArrayList
. You must add the
System.Collections
namespace and a private variable for our internal collection.
C#
using System;
using Microsoft.ReportingServices.DataProcessing;
using System.Collections;
VB.NET
Imports System
Imports Microsoft.ReportingServices.DataProcessing
Imports System.Collections
Implementing IDataParameterCollection
It would have been really elegant to create the DataParameterCollection with the Generics feature in
.NET 2.0. I chose not to use this because creating an object wrapper around an ArrayList should work with
all versions of the .NET Framework. The IDataParameterCollection interface defines a custom Add
Search WWH ::
Custom Search