DataReader

  • Thread starter Thread starter A.M
  • Start date Start date
A

A.M

Hi,

Is there a bultin function to copy a DataReader content into an array or any
in-memry datastructure ?

Thanks,
Ali
 
Hi Ali,

Thank you for using MSDN Newsgroup! My name is Kevin, and I will be
assisting you on this issue.

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to get data from a DataReader
object and put them into a DataSet. If there's any misunderstanding, please
feel free to let me know.

As far as I know, there isn't such a function in the .NET framework class
library that can get data from a DataReader and put them into a DataSet. I
think we have to implement ourselves. We can first create the columns
according to the DataReader. The SqlDataReader.GetSchemaTable method will
return a table including the schema information about the source table. So
we get that table and create columns in DataSet mapping to the fields in
DataReader. Then we can go through each row with SqlDataReader.Read() to
fill data to the DataSet. Actually DataAdapter fills a DataSet by doing so.

Does this answer your question? If anything is unclear, please feel free to
reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Ali,

I'm glad to know that my suggestion helps. If you have any further
questions, please feel free to post them in the newsgroup.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top