dataset table row into an arraylist

How to put a list of rows from dataset table into an array ?

I tried with this code but it doesn't help.

ArrayList arrayList = new ArrayList();

foreach (DataRow drin db.dataSetUsers.Tables["Functions"].Rows)

{

arrayList.Add (dr["Name"]);

}

[396 byte] By [Hrcko] at [2008-2-4]
# 1
Do you want to store the DataRow or the values from the DataRow?

In you code you are storing the value from the Name column in the ArrayList.

you can use the following code to add the compelete DataRow into an ArrayList

arrayList.Add( dr) ;

SaurabhNandu at 2007-9-8 > top of Msdn Tech,Visual C#,Visual C# IDE...
# 2
Hi,

Simplest option..Just call a Select on the DataTable with a blank string for filter.


DataRow []arrDataRow = null;
arrDataRow = db.dataSetUsers.Tables["Functions"].Select("");

This will give u an array of rows. (not an ArrayList)

Regards,
Vikram

Vikram at 2007-9-8 > top of Msdn Tech,Visual C#,Visual C# IDE...