Wrox Programmer Forums
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 September 3rd, 2004, 05:09 AM
Registered User
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataSets

How do you pass data from a dataset to an array

Old September 7th, 2004, 09:48 PM
Authorized User
Join Date: Jul 2004
Posts: 69
Thanks: 0
Thanked 1 Time in 1 Post

What data are you trying to pass? There is a lot of data stored in a DataSet. If you want the data in a particular columns (presumambly), then you can cycle through the dataset and populate an ArrayList like this:

ArrayList results = new ArrayList();

foreach(DataRow dr in ds.Tables[0].Rows)
  results.Add( dr[columnname] );

object[] aObjects = results.ToArray();

Hope this helps,

Get A Computer Job!

Similar Threads
Thread Thread Starter Forum Replies Last Post
When To Create Datasets AspNetGuy BOOK: Beginning ASP.NET 2.0 and Databases 2 July 6th, 2008 07:48 AM
C# .net2 need help with datasets ryan.thomson C# 2005 0 January 27th, 2006 04:11 PM
Comparing two datasets vip1976 ADO.NET 1 December 2nd, 2005 01:42 AM
Datasets Louisa VB.NET 2002/2003 Basics 1 October 6th, 2004 07:38 AM
Comparing DataSets. jitu ADO.NET 1 June 7th, 2004 11:18 AM

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