Re: DataSet -> DataReader by Miha
Miha
Fri Feb 20 09:38:15 CST 2004
Hi Dave,
You will have to implement IDataReader interface in a class that behaves
like datareader .
However, I still can't see where it might be useful.
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"Dave Cook" <nospam@nospam.com> wrote in message
news:ue4iOI89DHA.2524@TK2MSFTNGP11.phx.gbl...
> Hi Miha
>
> I have written a collection class that returns data from a database table.
> I would like to add a number of methods to the class that will also return
> the data in a variety of usefull formats as the data will be used in a
> variety of ways by different applications.
>
> Some of the methods I have so far are:
>
> SelectAllAsDataSet
> SelectAllAsDataTable
> SelectAllAsDataView
> SelectAllAsXML
>
> I would like to also be able to SelectAllAsDataReader. As all the above
> methods use the DataSet object, I create the DataSet in the constructor.
I
> was hoping to derive the DataReader from the existing DataSet rather than
> populating both objects as the table could potentially be quite large.
>
> Since looking more into it, i am not sure i can return a DataReader object
> from my class as the DataReader requires a permanent connection to the DB
> for the life of the object.
>
> If you have any ideas on this I would be gratefull.
>
> Regards
>
> Dave.
>
>
> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
> news:#mZCU#79DHA.1948@TK2MSFTNGP12.phx.gbl...
> > Hi Dave,
> >
> > Huh?
> > DataReader is just a sort of forward only readonly cursor.
> > Why would you need a DataReader from DataSet?
> >
> > --
> > Miha Markic [MVP C#] - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "Dave Cook" <nospam@nospam.com> wrote in message
> > news:uwob2t79DHA.3900@tk2msftngp13.phx.gbl...
> > > Is it possible to get a DataReader object from a DataSet/DataTable ?
If
> > so
> > > would it
> > > be disconnected ? in other words could I return a populated DataReader
> > > object from a class that contains a DataSet ?
> > >
> > >
> >
> >
>
>