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 steps in connecting to database ?
What is the difference between statement and preparedstatement interface?
If we want to connect to many databases in dataaccess layer such as MSAccess,Sql server,oracle means not to a particular database depends on condition we have to connect to appropriate database in this scenario if we without changing code Ho wdo you handle this situation?
How many major types of connection objects in ADO.NET?
Explain why canot we use multiple inheritance and garbage collector paralelly in .net?
Which object is used to add relationship between two Datatables?
Difference between ADO and ADO.Net
What is the meaning of executenonquery?
what is Sql Native Client?
What are the different methods available under the sqlcommand class to access the data?
What is Debug.write does?
If a table contains 20000 records. In a page at each time 100 records to be displayed.