DataSet to Generic List

S

shapper

Hello,

I have a DataSet which results from accessing an SQL database.
Each row is an Article and has various columns like Title,
Description, etc.

I have created a Generic List as follows:
Dim Articles As Generic.List(Of Article)

Article is a class with various properties. Each property is the same
as each column in the dataset.

I want to fill the Generic List with the data from my DataSet.

How can I do this?

Thanks,
Miguel
 
G

Guest

You would need an Article class with fields that mirror the columns in your
articles DataTable. You would then iterate over the rows, converting each row
to a new instance of your Article class (you could write a helper method
"DataRowToArticle" to assist in this), then adding each new Article instance
to your Generic List.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top