Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2008, 08:30 AM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default datareader to arraylist

how can i convert a datareader into an arraylist in vb.net?

thanks
 
Old February 25th, 2008, 10:50 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I don't think there is a way to directly convert it because they are completely different data types.

In short, you need to iterate over the data reader rows and create items to add to the ArrayList.

-Peter
peterlanoie.blog
 
Old February 25th, 2008, 10:55 AM
Authorized User
 
Join Date: Jan 2008
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

could you please write the code for that?

Many thanks
 
Old February 25th, 2008, 11:03 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

My consulting rate is 75USD/hour.

But I'm feeling generous so here's a start:

- You need a loop
- In the loop, create a new instance of your object
- Assign the data reader column values to your object
- Add the object to the array list

Some advise: Show us a little effort, blatantly asking us to do your work won't get you much. But I'll give you a few points for at least saying "please".

-Peter
peterlanoie.blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert datareader into ArrayList SKhna ASP.NET 2.0 Basics 2 February 26th, 2008 10:48 AM
ArrayList Mogg-Way C# 2005 5 February 12th, 2008 04:05 PM
Arraylist mechanism anwarraja Pro Java 1 September 6th, 2007 11:54 AM
Help with an arraylist crazy-nun General .NET 4 July 14th, 2005 03:32 AM
ArrayList kobystud C# 4 May 25th, 2004 02:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.