Looping through a dataset (VB .net)

Soldato
Joined
31 May 2006
Posts
4,239
Location
127.0.0.1
Hi all

I have found some nice code that imports and Excel spreadsheet into a dataset that then fills a Datagrid.

I want to loop through the dataset and act on each rows data (like you would loop through a recordset in vbs/VB6).

Has anyone got any example code of how to do this? Or is there a better way to this... maybe update my skillset from the dark ages! ;)

Cheers
 
I have found the solution:

Code:
Dim drCurrent As DataRow
        For Each drCurrent In objDataset1.Tables(0).Rows
            MsgBox(drCurrent.Item("FirstName"))
        Next

Where drCurrent.Item("FirstName") = the column header value or field name.
 
Back
Top Bottom