|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DbDataReader.previous()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 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. -- Show quote- Sahil Malik [MVP] ADO.NET 2.0 book - http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx ---------------------------------------------------------------------------- "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 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." 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." |
|||||||||||||||||||||||