Equivelsnt to old recordset & movenext

G

Guest

Hi,

Is there an equivelant to the old ado recordset which you could use the
movenext/moveprevious methdods with? If not, what do you use to do this in
ADO.NET? What would be the steps invloved in creating the equivelant object &
how do you iterate through the 'record set'? (I'm using c#)

Thanks very much for your thoughts on this.
 
S

Sahil Malik [MVP C#]

ADO.NET has two methods of working with data - connected and disconnected.

That leaves you with DataReader - connected, and DataAdapter/DataSet -
Disconnected

DataReader is a forward only/read only method of accessing data, it has a
method called "Read".
DataSet on the other hand is editable, but disconnected and is a tabular,
in-memory representation of data that can be accessed in a random fashion.

So there is no direct equivalent of a recordset, and I'd recommend picking
up a book and reading through ADO.NET, it is quite different from classic
ADO.

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

Paul Clement

¤ Hi,
¤
¤ Is there an equivelant to the old ado recordset which you could use the
¤ movenext/moveprevious methdods with? If not, what do you use to do this in
¤ ADO.NET? What would be the steps invloved in creating the equivelant object &
¤ how do you iterate through the 'record set'? (I'm using c#)
¤
¤ Thanks very much for your thoughts on this.

As Sahil mentioned, the DataReader has the closest equivalent functionality although it's a
forward-only result set. The DataTable is more flexible but conceptually different as the Row
collection can be accessed using For Each...Next or a row ordinal (index).

http://msdn2.microsoft.com/en-us/library/system.data.datatable.rows.aspx


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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