RS.Eof to asp.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What's the best way to loop through records in ASP.NET. For example if I
want to build an array off of the table or use the values in on a
non-presentational way?

Thanks,
Nathan
 
yeap as Sahil & Steve mentioned
For datareader object it's
while(yourDataReader.Read())
{
// your loop... do what you gotta do here
}
yourDataReader.Close();

for DataSet
foreach(DataRow dr in yourDataSet.Tables[0].Rows)
{
// your loop... do what you gotta do here
}
--

Regards,

Hermit Dave
(http://hdave.blogspot.com)
 
There is no "best way." There are more than one container for database
records in .Net. There is the DataReader, a forward-only, read-only
connected "cursor" to a result set. There is a DataTable, which is a
serializable disconnected record set. There is a DataSet, which is a
container for DataTables.

I would advise you to familiarize yourself with these classes, and what each
of them is best used for, as well as the various ways you can use them.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Back
Top