Databases Reference
In-Depth Information
Declarations
The variables of the DataSetDataReader hold all the information that you will use to build the properties
supported by the DataSetDataReader class. The m_currentRow variable is used to store the value of the
current row as the data is being read from your CSV data file. The string array m_names contains the names
of the fields that will be read, while the m_types array provides access to the type of data that will be read.
As the data is read, it will be loaded into an array of the object type called m_cols. Data from the file will
be read by an internal StreamReader class called sr .
C#
FCLData.DataView dataView;
DataSetCommand dataSetCommand = null;
int currentRow= -1;
VB.NET
Private dataView As FCLData.DataView = Nothing
Private dataSetCommand As dataSetCommand = Nothing
Private currentRow As Integer = -1
Implementing IDbDataReader
The IDbDataReader interface enforces consistency in working with data. It provides properties and
methods that allow you to examine the data and its types as well as the Read method that will actually
do the dirty work.
C#
public interface IDataReader : IDisposable
{
Type GetFieldType(int fieldIndex);
string GetName(int fieldIndex);
int GetOrdinal(string fieldName);
object GetValue(int fieldIndex);
bool Read();
int FieldCount { get; }
}
VB.NET
Public Interface IDataReader
Inherits IDisposable
Function GetFieldType(ByVal fieldIndex As Integer) As Type
Function GetName(ByVal fieldIndex As Integer) As String
Function GetOrdinal(ByVal fieldName As String) As Integer
Function GetValue(ByVal fieldIndex As Integer) As Object
Function Read() As Boolean
Property FieldCount() As Integer
End Interface
You need to modify your class definition to force the custom DataSetDataReader class to support the
interface requirements.
Search WWH ::




Custom Search