Databases Reference
In-Depth Information
C#
public IDataParameter CreateParameter()
{ //return DataSetDataParameter
return new DataSetDataParameter();
}
VB.NET
Public Function CreateParameter() As IDataParameter _
Implements IDbCommand.CreateParameter
Return New DataSetDataParameter
End Function
Parameters Property
The Parameters property returns a collection that implements the IDataParameterCollection interface.
Your custom collection class is the DataSetParameterCollection and satisfies these requirements. The
Parameters property allows the developer to index into the Parameters collection to set or get the
parameter values.
C#
public IDataParameterCollection Parameters
{
get
{
Debug.WriteLine (“IDBCommand: Retrieving parameters list”);
return this.m_parameters;
}
}
VB.NET
Public ReadOnly Property Parameters() As IDataParameterCollection Implements
IDbCommand.Parameters
Get
Debug.WriteLine(“IDBCommand: Retrieving parameters list”)
Return Me.m_parameters
End Get
End Property
Creating the DataReader Object
The data reader in our implementation does nothing more than read properties of our internal DataView.
The behavior of the data reader is enforced by the IDbDataReader interface, which supplies methods to
indicate the number, names, and types of the fields that will be read. It also allows the object to actually
access the data.
To add the DataSetDataReader class to the project, choose Project
Add Class from the menu. Change
the name of the class to DataSetDataReader. After adding the class, add the custom namespace and
edit the class definition.
Search WWH ::




Custom Search