"Sweetiecakes" <x@x.comwrote in message
news:48***********************@news.fv.fi...
Is there an example of looping through a dataset filling an array with it?
It is not clear what you want. The dataset is hierarchical: it contains a
collection of tables that contain a collection of rows that contain multiple
clumns. So it will not directly fit into an array, which does not have such
a structure. You could create an array of a sepecific datatype, such as
string, and fill it with the values of a certain column of all the rows of a
certain table:
DataSet ds = ...;
DataTable dt = ds.Tables[0];
const int desiredColumn = 1; //for instance
int length = dt.Rows.Count;
string[] theArray = new string[length];
for (int i=0; i<length; i++)
{
theArray[i] = dt.Rows[i][desiredColumn];
}