DataSet to Generic List

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
Back
Top