looping thru a dataSet

'create instance of user control that connects to database and also
'houses a getMainNavigationInfo method which returns a dataset
Dim compDataAccess As New basketAuction.dataActions()

Dim dsNavData As New System.Data.DataSet
Dim strHrefLoc As String
Dim sqlMenuItemInfo As String
Dim strMenuHTML As String'completed menu HTML string to return to calling page

sqlMenuItemInfo = "SELECT navLis.itemId, navLis.itemText, navLis.itemAlternatePath " & _
"FROM navLis " &
"WHERE (((Len([itemId]))=1) AND ((navLis.itemActive)=True)) " & _
"ORDER BY navLis.itemId;"

dsNavData = compDataAccess.getMainNavigationInfo(sqlMenuItemInfo)


now in classic ASP I would loop through the record set like this:

If Not rsMenuItemInfo.EOF Then
rsMenuItemInfo.MoveFirst
Do Until rsMenuItemInfo.EOF
process current record.....
Loop
End If


my question is this: how do I loop through the records in a dataset in ASP.Net? Thanks

dogI don't know the exactly syntaxis in VB.Net but this is it the C# way:
foreach(DataRow dr in dsNavData.Tables[0].Rows)
{
...do what you want with dr as it is a DataRow
}
 
Back
Top