H
Hrvoje Voda
How to put a specified dataset table into an array list ?
Hrcko
Hrcko
Adam Barker said:arrayList.Add("myArrayList", dSet.Tables["MyTable"]);
Hrvoje Voda said:How to put a specified dataset table into an array list ?
Hrcko
I managed to fill an array, but I don't konw how to get
a real informations from that array.
When I try to fill a list with items from that array,
I get: System.Collections.ArrayList, and not the actual data.
list.Items.Add(arrayList);
arrayList.Add (db.dataSetUsers.Functions);
Functions is a name of the table in dataset.
So, when I user ArrayList.AddRange it's an error.
I tried to put all that I could remember into
foreach()
{
...
}
but I just can't find a code that will put a
column names into an ArrayList.
Bjorn Abelli said:...
I tried to put all that I could remember into
foreach()
{
...
}
but I just can't find a code that will put a
column names into an ArrayList.
If you want the column name from a specific column, you can get it through
its index, e.g.:
DataColumnCollection columns =
db.dataSetUsers.Functions.Columns;
for (int i = 0; i < columns.Count; i++)
{
string colname = columns.ColumnName;
// do something with the column name
}
// Bjorn A
Sorry, it's not column names but row names.
I tried to put DataRowCollection...
but I don't know how to get the row name.
I don't want to get the names of columns but of their rows.
For example: The name of the column is FunctionName,
but in the row is "Function for all".
Bjorn Abelli said:...
I don't want to get the names of columns but of their rows.
For example: The name of the column is FunctionName,
but in the row is "Function for all".
Let's see if I got this right...
So you *know* the column name...
You want the *content* of the column "FunctionName" from each row...
And then you want to add that to an ArrayList...
You could try this:
foreach (DataRow row in db.dataSetUsers.Functions.Rows)
{
string x = row["FunctionName"].ToString();
arrayList.Add ( x );
}
// Bjorn A
Hrvoje Voda said:I tried that,
but when I fill a listbox with that arrayList I get :
System.Collection.ArrayList