Home All Groups Group Topic Archive Search About
Author
4 Nov 2005 4:27 AM
David Thielen
Hi;

In .net 2.0 I need the ability to not only get the next row in a result set,
but also the previous. Is there a way to do this in .net? (Similiar to the
JDBC ResultSet.previous?)

--
thanks - dave

Author
4 Nov 2005 5:34 AM
Sahil Malik [MVP]
DataReaders are forward only / read only. If you need such random access
between records, you either need to write your own server side cursor
implementation (not recommended), or go the DataTable/DataSet route.


--

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
----------------------------------------------------------------------------

Show quote
"David Thielen" <thielen@nospam.nospam> wrote in message
news:6ED4D64E-D7D5-4485-B864-06403A3A40CC@microsoft.com...
> Hi;
>
> In .net 2.0 I need the ability to not only get the next row in a result
> set,
> but also the previous. Is there a way to do this in .net? (Similiar to the
> JDBC ResultSet.previous?)
>
> --
> thanks - dave
Author
4 Nov 2005 5:42 AM
Kevin Yu [MSFT]
Hi Dave,

In .NET 2.0, you can use Multiple Active Result Sets to achieve this. That
is open multiple DataReader on one connection object. However, this can
only be done with SQL server 2005. Please check the following link for more
information.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/htm
l/MARSinSQL05.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Author
4 Nov 2005 5:45 AM
Kevin Yu [MSFT]
Sorry, dave. My previous post was answering you another post. I mis-post it
to this issue.

For this issue. In .net 2.0 the DataRader cannot get the previous row.
Because it is readonly and forward-only. In this case you have to fill the
result set to a DataSet and you can do what you need within the Dataset.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

AddThis Social Bookmark Button