473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DataSet to Generic List

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

Apr 28 '07 #1
1 1545
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
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"shapper" wrote:
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

Apr 28 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Filippo Pandiani | last post by:
I have a grid that shows the file list from a folder. On the postback, how do I get a Dataset from this grid? Thanks, Filippo.
5
by: Steven C | last post by:
Hello: I am trying to append a dataset that draws its data from a MSDE instance, and I keep getting the exception: Can't create a child list for field tblCustomers. conn = new...
4
by: Steve | last post by:
C# I have some combo boxes, full of lookup descriptions. When I retrieve a dataset for my record, the values that need binding to the combos are the actual record IDs that relate to these...
8
by: GaryDean | last post by:
In an 2.0 asp app I used vs.net 2005 to create a TableAdapter:Dataset in my App_code directory. I also created a new vb class in that same directory. I have two issues: 1. I notice that there...
1
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't...
1
by: bcornett | last post by:
I am needing a way to extract a dataset from a sqldatsource. I am doing this to create a Generic Printing page. I will pass the dataset and an arraylist of grid_view propeties to this Generic...
3
by: shapper | last post by:
Hello, I have a stored procedures as follows: SELECT a.ArticleID, a.Title, a.Content, c.CommentId, c.Title, c.Comment FROM Articles a INNER JOIN Comments c ON a.ArticleID = c.CommentID...
0
by: jobs | last post by:
re: ObjectDataSource SelectMethod TypeName returning a Dataset? is this really a DAL? Pardon my misguided email on the subject... I'm working in asp.net 2.0 and vb.net 2005. Say I don't...
4
by: shapper | last post by:
Hello, I am getting various records from a database: Dim ds As DataSet = db.ExecuteDataSet(dbc) Each record has 3 fields: Id, Name and Text. I have a class named MyClass with 3 properties...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.