datareader - connected or disconnected ^_^

F

Fred

hi,
some time ago in "the dot net show" i heard that microsoft has found no
usages for connected data access and all ado.net is disconnected; on the
other hand many ppl belive data readers keep open connection to the database

so i`m just curios wats the truth :)
 
M

Marina

I am sure you misinterpreted what was said. No one would every say that
connected data access is completely useless in all circumstances or that
microsoft dropped support for it.

Data readers are connected to the database. This is not a 'belief' - this
is well documented in the .NET framework documentation. Have you looked
there?

Excerpt from the SqlDataReader section:
While the SqlDataReader is in use, the associated SqlConnection is busy
serving the SqlDataReader, and no other operations can be performed on the
SqlConnection other than closing it.

This would also be very easy to test - shut down your database server while
you are looping through a data reader and see what happens. Or check the
connection's state while reading data from a datareader.
 
F

Fred

Marina said:
I am sure you misinterpreted what was said. No one would every say that
connected data access is completely useless in all circumstances or that
microsoft dropped support for it.

Data readers are connected to the database. This is not a 'belief' - this
is well documented in the .NET framework documentation. Have you looked
there?

Excerpt from the SqlDataReader section:
While the SqlDataReader is in use, the associated SqlConnection is busy
serving the SqlDataReader, and no other operations can be performed on the
SqlConnection other than closing it.

This would also be very easy to test - shut down your database server while
you are looping through a data reader and see what happens. Or check the
connection's state while reading data from a datareader.


i do believe u ^_^
 
F

Fred

C

Cor Ligthert [MVP]

Fred,

Connected data and disconnected data is the way as the data is handled.

Not the way as it is retrieved. To get data there will always be a kind of
connection, therefore the datareader is just a connected way of getting
data.

Internet, PDA's or whatever non connected device makes it impossible to
handle the data connected to the DataBase server as it was done with a
windowsform.

Beside that are millions connected handled tables (recordsets) probably to
much for any database server, while in the disconnected way it means only a
slower handling of the messages that it gets to handle the
retrieving/updating of the data.

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top