RS.Eof to asp.net

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
 
H

Hermit Dave

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)
 
K

Kevin Spencer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top