473,408 Members | 1,821 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,408 software developers and data experts.

Dataset into array

Can someone point me to an example of populating an array from either a
dataset or a datareader ?

This .net stuff is killing me.
Nov 18 '05 #1
3 5787
Try this, assuming your data can be a string;

Dim arData() As String
Dim ds As New DataSet
' Fill your dataset in your own way here

ReDim arData(ds.Tables(0).Rows.Count)

For intCounter As Integer = 0 To ds.Tables(0).Rows.Count - 1
arData(intCounter) = ds.Tables(0).Rows(intCounter).Item(0).ToString

Next

--
Gerry O'Brien
Visual Developer .NET MVP
Visual Basic

"Poppy" <pa**********@NOSPAMthemedialounge.com> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
Can someone point me to an example of populating an array from either a
dataset or a datareader ?

This .net stuff is killing me.

Nov 18 '05 #2
Hi,

Following code will help you to populate the data from the datareader in to
an arraylist.

ArrayList rowList = new ArrayList();
SqlDataReader reader = storedProcCommand.ExecuteReader();
while (reader.Read())
{
object[] values = new object[reader.FieldCount];
reader.GetValues(values);
rowList.Add(values);
}

10Cents
Regards
Ashish M Bhonkiya

"Poppy" <pa**********@NOSPAMthemedialounge.com> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
Can someone point me to an example of populating an array from either a
dataset or a datareader ?

This .net stuff is killing me.

Nov 18 '05 #3
Thanks All

Much Appreciated.
"Ashish M Bhonkiya" <bh******@hotmail.com.nospam> wrote in message
news:u#**************@TK2MSFTNGP12.phx.gbl...
Hi,

Following code will help you to populate the data from the datareader in to an arraylist.

ArrayList rowList = new ArrayList();
SqlDataReader reader = storedProcCommand.ExecuteReader();
while (reader.Read())
{
object[] values = new object[reader.FieldCount];
reader.GetValues(values);
rowList.Add(values);
}

10Cents
Regards
Ashish M Bhonkiya

"Poppy" <pa**********@NOSPAMthemedialounge.com> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
Can someone point me to an example of populating an array from either a
dataset or a datareader ?

This .net stuff is killing me.


Nov 18 '05 #4

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

Similar topics

4
by: Simon | last post by:
Hi all, I have a process, where I take a dataset from an SQL call, and need to write an XML file from that dataset. The data set can contain 10's of tables, each with 100's of rows, and I have...
1
by: David D. McCrory | last post by:
I have the following that returns an array of a struct and I want to load it into a DataSet on the consumer side.....Can someone provide me with an example of how to use the DataSet.ReadXml()...
2
by: Marty McDonald | last post by:
I have an array of objects (my own custom class). I'm trying to convert that array to a dataset. So I serialize the array to XML, then try to load the XML to a dataset. MemoryStream mem = new...
1
by: STeve | last post by:
Hi guys, I was wondering how I would go about creating a string array from a single column from a dataset. What I was thinking was iterate through each row in the dataset, finding out the size...
5
by: Trond | last post by:
I have a webservice that is returning a dataset. In dataset there is a table with 4 columns. (LDate, LTime, LDepth and ServiceNumber) I then try to read only 2 of the columns into array (double...
5
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into...
12
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they...
7
by: Bob | last post by:
Hi, I have a typed unbound dataset that is passed to a datahandling class to be filled. The datahandling class fills it from a sproc using an oledbDataAdapter (SQLAnywhere database) The only...
1
by: TiGeR79 | last post by:
Hello, I've written a webservice which returns a dataset containing just one table with two columns. One colum holds a string while te second holds an image serialized into a byte array. This...
0
by: OscarPiacenza | last post by:
Hello all. :) My name is Oscar and I’m a novice on XML and dataset arguments. I need some help to resolve (and understand :) ) the following problem: I have stored some data in a SqlServer...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.