PDA

View Full Version : How to loop a dataset to process data row by row


bruce
04-28-2004, 12:51 AM
It's similiar.

see http://kb.discountasp.net/article.aspx?id=10023

[b]quote:Originally posted by jerry1027

Dear all,

I am new to ASP.Net and I have generated a dataset but I need to do some calculation on the data before showing them in the datagrid. How can I process the dataset row by row just as we often do in ASP?

In ASP we often wrote :
Do while not rsData.eof
.........
rsData.Movenext
End While

But what about in ASP.Net?

Jerry the man
</blockquote id="quote"></font id="quote">

jerry1027
04-28-2004, 11:06 AM
Dear all,

I am new to ASP.Net and I have generated a dataset but I need to do some calculation on the data before showing them in the datagrid. How can I process the dataset row by row just as we often do in ASP?

In ASP we often wrote :
Do while not rsData.eof
.........
rsData.Movenext
End While

But what about in ASP.Net?

Jerry the man

longday
05-12-2004, 08:34 AM
I usually do a for each loop similar to this:

'ds = dataset
'dt = datatable
'dr = datarow

dt = ds.tables("tablename")
for each dr in dt.rows
dr("FieldName")
next

[b]quote:Originally posted by jerry1027

Dear all,

I am new to ASP.Net and I have generated a dataset but I need to do some calculation on the data before showing them in the datagrid. How can I process the dataset row by row just as we often do in ASP?

In ASP we often wrote :
Do while not rsData.eof
.........
rsData.Movenext
End While

But what about in ASP.Net?

Jerry the man
</blockquote id="quote"></font id="quote">

Eric Brasher