Previous Thread:   SqlContext.Pipe.Send

2/24/2006 2:36:28 PM    DataTableReader to SqlDataReader
Any magic to convert from one to another? I want to pass a DataTable as a  
  
resultset and thought I could pass the "DataReader" that's exported by  
  
CreateDataReader on the 2.0 DataTable class.  
  
--  
  
____________________________________  
  
William (Bill) Vaughn  
  
Author, Mentor, Consultant  
  
Microsoft MVP  
  
INETA Speaker  
  
www.betav.com/blog/billva  
  
www.betav.com  
  
Please reply only to the newsgroup so that others can benefit.  
  
This posting is provided "AS IS" with no warranties, and confers no rights.  
  
__________________________________



2/24/2006 6:25:28 PM    Re: DataTableReader to SqlDataReader
Yea, I figgered as much. Thanks anyway.  
  
--  
  
____________________________________  
  
William (Bill) Vaughn  
  
Author, Mentor, Consultant  
  
Microsoft MVP  
  
INETA Speaker  
  
www.betav.com/blog/billva  
  
www.betav.com  
  
Please reply only to the newsgroup so that others can benefit.  
  
This posting is provided "AS IS" with no warranties, and confers no rights.  
  
__________________________________  
  
"Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in message  
  
news:eDIis4ZOGHA.2036@TK2MSFTNGP14.phx.gbl...

2/24/2006 6:58:06 PM    Re: DataTableReader to SqlDataReader
"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message  
  
news:OrJuBLZOGHA.2300@TK2MSFTNGP15.phx.gbl...  
  
None that I know of :( -- I think you'll have to use  
  
SendResultsStart/SendResultsEnd and send the results row by row.  
  
--  
  
Adam Machanic  
  
Pro SQL Server 2005, available now  
  
http://www.apress.com/book/bookDisplay.html?bID=457  
  
--

2/25/2006 3:57:24 AM    Re: DataTableReader to SqlDataReader
"William \(Bill\) Vaughn" <billvaRemoveThis@nwlink.com> wrote in  
  
news:OrJuBLZOGHA.2300@TK2MSFTNGP15.phx.gbl:  
  
No, there isn't. Reason for this is that the DataReader you're getting  
  
from CreateReader on a DataTable is a DataTableReader. Sure it derives  
  
from DbDataReader as the SalDataReader, but the DataTableReader is not  
  
castable to a SqlDataReader (the DataTableReader soes not implement all  
  
interfaces that the SqlDataReader does).  
  
Niels  
  
--  
  
**************************************************  
  
* Niels Berglund  
  
* http://staff.develop.com/nielsb  
  
* nielsb@no-spam.develop.com  
  
* "A First Look at SQL Server 2005 for Developers"  
  
* http://www.awprofessional.com/title/0321180593  
  
**************************************************

2/25/2006 12:18:28 PM    Re: DataTableReader to SqlDataReader
"Adam Machanic" <amachanic@hotmail._removetoemail_.com> wrote in  
  
news:eSyyO5jOGHA.3944@tk2msftngp13.phx.gbl:  
  
I believe it was ISqlReader (or ISqlDataReader or something similar),  
  
but that interface disappeared in the client/server merge.  
  
I agree with you about the "elegance" factor, however in Bill's specific  
  
case the perf would suffer, (I assume he wants a DataTable 'cause it may  
  
be easier to work with than the individual rows), if he works with data  
  
from the database.  
  
Niels  
  
--  
  
**************************************************  
  
* Niels Berglund  
  
* http://staff.develop.com/nielsb  
  
* nielsb@no-spam.develop.com  
  
* "A First Look at SQL Server 2005 for Developers"  
  
* http://www.awprofessional.com/title/0321180593  
  
**************************************************

2/25/2006 2:04:21 PM    Re: DataTableReader to SqlDataReader
"Niels Berglund" <nielsb@develop.com> wrote in message  
  
news:Xns9775799B3F254nielsbdevelopcom@207.46.248.16...  
  
I seem to remember in the earlier betas that you could return an  
  
instance of IDataReader (or was it ISqlReader?)  It would have been nice if  
  
that had been brought forward, for both this scenario and scenarios  
  
involving the need to return custom sets of data from external non-database  
  
sources -- doing the row-by-row thing is, in my opinion, not nearly as  
  
elegant a solution as implementing an interface for a custom collection.  
  
Although I also seem to recall that the interface required something like 40  
  
methods -- probably the reason that functionality was removed?  
  
--  
  
Adam Machanic  
  
Pro SQL Server 2005, available now  
  
http://www.apress.com/book/bookDisplay.html?bID=457  
  
--

2/25/2006 4:30:02 PM    Re: DataTableReader to SqlDataReader
"Niels Berglund" <nielsb@develop.com> wrote in message  
  
news:Xns9775CE8EDF3CBnielsbdevelopcom@207.46.248.16...  
  
What I was getting at was, the DataTableReader could also implement that  
  
interface if it were still around, thereby making this a non-issue (and  
  
possibly better performance than having to go through the SqlDataRecord  
  
exercise for every row -- or at least, a lot less code involved).  
  
--  
  
Adam Machanic  
  
Pro SQL Server 2005, available now  
  
http://www.apress.com/book/bookDisplay.html?bID=457  
  
--