Thursday, March 22, 2012

Looping record

In classic ASP, we need to do looping to get data from a query. How canI do the same thing using ASP.NET (VB.NET)? I still want to havethe control, the looping mechanism.
In classic ASP:
while not rs.eof
' do something
wend
In ASP.NET..? I know I can use a data control, but the point is I want to loop each record.

Thanks,

use a datareader object and do

DoWhile moduleSqlDataReader.Read
process here,,,
loop
i come from asp3 as well....remember that a datareader is forward only if you want to do some multiple passes you will have to use something else.
1 pass this is the most efficient manner.
Joel


Hi There,
You can do something like this

dtrRecords = cmdSelect.ExecuteReader()

If dtrRecords.HasRowsThen

While (dtrRecords.Read())
'do something

EndWhile

EndIf

dtrRecords.Close()
Hope it helps!


Thanks for your helps!

0 comments:

Post a Comment