PC Review


Reply
Thread Tools Rate Thread

DbDataReader.previous()

 
 
=?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=
Guest
Posts: n/a
 
      4th Nov 2005
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
 
Reply With Quote
 
 
 
 
Sahil Malik [MVP]
Guest
Posts: n/a
 
      4th Nov 2005
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.ma.../13/63199.aspx
----------------------------------------------------------------------------

"David Thielen" <(E-Mail Removed)> wrote in message
news:6ED4D64E-D7D5-4485-B864-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      4th Nov 2005
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/de...us/dnsql90/htm
l/MARSinSQL05.asp

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

 
Reply With Quote
 
Kevin Yu [MSFT]
Guest
Posts: n/a
 
      4th Nov 2005
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."

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dbDataReader Mr. X. Microsoft C# .NET 5 25th Sep 2010 01:34 AM
DbDataReader.HasRows - Whose Idea was that? Jehu Galeahsa Microsoft C# .NET 1 29th May 2010 01:57 AM
DbConnection, DbDataReader and DbCommand Jelle de Jong Microsoft C# .NET 2 11th Mar 2008 02:10 AM
DbDataReader numRows? =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= Microsoft ADO .NET 6 6th Nov 2005 12:02 PM
DbDataReader.Read() result =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= Microsoft ADO .NET 2 5th Nov 2005 01:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:03 AM.