Walkthru DataSet

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a DataSet that's filled by a Odbc command.. Is there a method
to walkthrough the result with a for loop? I can't get it to work.

Thankz,
Peter
 
Well, I assume you want to iterate through the rows in a table in your
dataset.

Something like this would work.

DataSet ds = GetPopulatedDataSet(); // This or however you populate it
DataTable dt = ds.Tables[0]; // assumes there's only 1 table
foreach(DataRow dr in dt.Rows)
{
... Get at your data via dr["fieldname"] among other ways ...
}

Pete
 
Well, I assume you want to iterate through the rows in a table in your
dataset.

Something like this would work.

DataSet ds = GetPopulatedDataSet(); // This or however you populate it
DataTable dt = ds.Tables[0]; // assumes there's only 1 table
foreach(DataRow dr in dt.Rows)
{
... Get at your data via dr["fieldname"] among other ways ...
}

Pete


It worked thankz..
 
Back
Top