Why DataReader is Forward Only?
Answers were Sorted based on User's Feedback
Answer / vrushali
DataReaader is connected object and one can process the
rows that are returned by query, one at a time. It discards
every row after you have gone through it and so it is
extremely fast.It contains only read-only data, so no
updates are allowed using DataReader
objects.
Is This Answer Correct ? | 51 Yes | 3 No |
Answer / lovely
Data Reader worked as conventional Record Set of VB
and
Data Reader worked in connected mode only
Is This Answer Correct ? | 52 Yes | 13 No |
Answer / sachin gupta
Because it inherit DbDataReader Abstract Class and
DbDataReader Abstract Inherit the IEnumerable and its give
GetEnumerator(Returns an enumerator that iterates through a
collection.)its Type IEnumerator and IEnumerator gives
MoveNext() Method so Datareader is Forward only.
Is This Answer Correct ? | 25 Yes | 1 No |
Answer / guneetinder singh
because it satisfy read only property from which we can only
retrieve data only(forword) not write to int(backword).
Is This Answer Correct ? | 29 Yes | 7 No |
Answer / rahul singhal
datareader execute data from table one by one at each
calling of it.and to fetch next value from database it
contains pointer value(index) of next value . thats why if
is forward only. in the oops concept it works on the concept
of one-way linklist
Is This Answer Correct ? | 23 Yes | 2 No |
Answer / manumole
A DataReader is a stream of data that is returned from a
database query. When the query is executed, the first row
is returned to the DataReader via the stream. The stream
then remains connected to the database, poised to retrieve
the next record. The DataReader reads one row at a time
from the database and can only move forward, one record at
a time. As the DataReader reads the rows from the database,
the values of the columns in each row can be read and
evaluated, but they cannot be edited.
Is This Answer Correct ? | 19 Yes | 2 No |
Answer / nevin jain
from all 11 above answer only Sachin Gupta have given write
answer...
becoz SqlDataReader inherit DbDataReader whose base type is
IEnumerable that use to access collection through simple
iteration which is forward only manner...
Basically SqlDataReader Class access records n retrieve them
as collection through simple iteration...
to make more clear first read Functionality of IEnumerable
interface that expose GetEnumerator() method...
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / sandyni
As we know that DataReader is connected architecture it
cannot persists the contents. it reads the contents one by
one record from the dataset until all the records completed.
The main thing is data reader uses pointers to fetch the
next record(index).hence these are the forward only objects
Is This Answer Correct ? | 6 Yes | 4 No |
Because it inherites the IEnumerable.IEnumarble contains
the method(getenumerator) its type is IEnumerator it
returns the instance of IEnumerator that implements in a
class that contains three methods current(),movenext(),
reset().Ist call the current() than movenext() move first
tuple to last tuple in the table than call reset() than
cursor moves on the current().So,DataReader works in
forward only and Read only manner.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / srikanth r
To support faster data access in the connected environment.
Is This Answer Correct ? | 1 Yes | 1 No |
What are the advantages and drawbacks of using ado.net?
What are three methods for displaying data in a syncfusion datagrid
how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....
What is the executescalar method?
How to insert multiple records in asp .net from Gridview to Sql Database with out using loop condition ?
What is a non query?
What is basic use of data view?
How can you add or remove rows from the datatable object of dataset?
What is Serialization in .NET? what are the types of Serialization?
What is the namespace in which .NET has the data functionality classes?
What is the use of adodc?
Can we load multiple tables in a dataset?