|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how to move record forward or backwardhi 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 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 > > 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 > > > > > > 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 >> > >> > >> >> > > 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 > >
Other interesting topics
Removing rows from a DataTable is VERY slow
Specifying format of DateTime columns read from CSV files DataSet Memory Usage SQLDataReader data adapter update using datatable that has MANY changes Aborting a thread corrupts my SqlConnection (?) Evaluating Reporting Tools for .NET Storing passwords in database Problem copying datatable-long post I can't fill a required field in a record Add (before EndEdit) |
|||||||||||||||||||||||