Home All Groups Group Topic Archive Search About

how to move record forward or backward

Author
30 Nov 2004 1:19 PM
hui
hi all

I have got a datareader by sqlcommand, now I wanna move forward or backward,
but I don't find first,last,prior and next methods. How can I do it?

thanks for your suggestion.

hui
Author
30 Nov 2004 1:32 PM
Carlos Perestrelo Correia
to the best of my knowledge you will not be able to do this using a
datareader as it is foward only. You should consider using a DataAdapter and
DataSet
using the Fill method of a DataAdaptor. Post if you need further help.

Show quoteHide quote
"hui" <liu***@jxmu.edu.cn> wrote in message
news:%23B867%23t1EHA.132@tk2msftngp13.phx.gbl...
> hi all
>
> I have got a datareader by sqlcommand, now I wanna move forward or
> backward,
> but I don't find first,last,prior and next methods. How can I do it?
>
> thanks for your suggestion.
>
> hui
>
>
Are all your drivers up to date? click for free checkup

Author
30 Nov 2004 2:08 PM
hui
thank you first.

I am newbie to c#. could you show me some example codes about how to move
record cursor with DataAdapter and Dataset?

hui


Show quoteHide quote
"Carlos Perestrelo Correia" <cepcorr***@hotmail.com> wrote in message
news:OHOlFFu1EHA.3816@TK2MSFTNGP09.phx.gbl...
>
> to the best of my knowledge you will not be able to do this using a
> datareader as it is foward only. You should consider using a DataAdapter
and
> DataSet
> using the Fill method of a DataAdaptor. Post if you need further help.
>
> "hui" <liu***@jxmu.edu.cn> wrote in message
> news:%23B867%23t1EHA.132@tk2msftngp13.phx.gbl...
> > hi all
> >
> > I have got a datareader by sqlcommand, now I wanna move forward or
> > backward,
> > but I don't find first,last,prior and next methods. How can I do it?
> >
> > thanks for your suggestion.
> >
> > hui
> >
> >
>
>
Author
30 Nov 2004 5:48 PM
Scott M.
You use a DataAdapter to get a copy of the data you need brought into your
application and stored in a DataTable.  The DataTable is made up of rows and
each row has its Items (columns). By iterating through rows and looking at
an item in a row, you can get and set data in your DataTable.

Now, a DataTable could be just one in a collection of DataTables.  For this
reason, there is another object called a DataSet.  A DataSet has a Tables
collection, which holds the previously mentioned DataTable object(s).


Show quoteHide quote
"hui" <liu***@jxmu.edu.cn> wrote in message
news:%23rqpKau1EHA.412@TK2MSFTNGP14.phx.gbl...
> thank you first.
>
> I am newbie to c#. could you show me some example codes about how to move
> record cursor with DataAdapter and Dataset?
>
> hui
>
>
> "Carlos Perestrelo Correia" <cepcorr***@hotmail.com> wrote in message
> news:OHOlFFu1EHA.3816@TK2MSFTNGP09.phx.gbl...
>>
>> to the best of my knowledge you will not be able to do this using a
>> datareader as it is foward only. You should consider using a DataAdapter
> and
>> DataSet
>> using the Fill method of a DataAdaptor. Post if you need further help.
>>
>> "hui" <liu***@jxmu.edu.cn> wrote in message
>> news:%23B867%23t1EHA.132@tk2msftngp13.phx.gbl...
>> > hi all
>> >
>> > I have got a datareader by sqlcommand, now I wanna move forward or
>> > backward,
>> > but I don't find first,last,prior and next methods. How can I do it?
>> >
>> > thanks for your suggestion.
>> >
>> > hui
>> >
>> >
>>
>>
>
>
Author
30 Nov 2004 1:56 PM
Scott M.
A DataReader has a "Read" method which advances you to the next record as
well as returning a Boolean value indicating if there is a next record to
move to.  You can not back up as a DataReader is a Read Only, Forward Only
mechanism.

Show quoteHide quote
"hui" <liu***@jxmu.edu.cn> wrote in message
news:%23B867%23t1EHA.132@tk2msftngp13.phx.gbl...
> hi all
>
> I have got a datareader by sqlcommand, now I wanna move forward or
> backward,
> but I don't find first,last,prior and next methods. How can I do it?
>
> thanks for your suggestion.
>
> hui
>
>

Bookmark and Share