Databases Reference
In-Depth Information
GetOrdinal Function
The GetName method allows the developer to index the data based on its position within the
DataReader stream.
C#
public int GetOrdinal (String fieldName)
{
return( this.dataView.Table.Columns[fieldName].Ordinal);
}
VB.NET
Public Function GetOrdinal(ByVal fieldName As String) As Integer Implements
IDataReader.GetOrdinal
Return (Me.dataView.Table.Columns(fieldName).Ordinal)
End Function
GetValue Function
The GetValue function retrieves the actual value from the data stream. All of these methods are typi-
cally used together. The developer pulls the type information from the stream, creates variables of the
correct type to hold this data, and gets the values of the data using the GetValue function.
C#
public object GetValue (int fieldIndex)
{
return( this.dataView [this.currentRow] [fieldIndex]);
}
VB.NET
Public Function GetValue(ByVal fieldIndex As Integer) As Object Implements
IDataReader.GetValue
Return (Me.dataView(Me.currentRow)(fieldIndex))
End Function
Read Method
The Read method is the workhorse of the DataSetDataReader class. The function loops through the current
DataView. If a line is successfully read, this is indicated to the user of your extension by incrementing the
row count variable m_currentRow and by returning a Boolean value. As long as true is returned, data is
successfully read. False is returned when the internal view hits the end of the result set.
C#
public Boolean Read ()
{
this.currentRow ++;
if (this.currentRow >= this.dataView.Count)
{
return (false);
Search WWH ::




Custom Search