looping through collection

Posts   
 
    
jaxon
User
Posts: 20
Joined: 21-Sep-2005
# Posted on: 08-Dec-2005 17:56:24   

I'm not sure if I am missing something out of the documentation but is there a way I can loop through the entity collection like I can with a dataset?

say this example..

    Dim myDesign As New clsDesigns
    Dim ds As DataSet = myDesign.GetHomePageClients()
    Dim ProjectName As String


    Do While i < ds.Tables(0).Rows.Count
        ProjectName = ds.Tables(0).Rows(i).Item("ProjectName")
        divDesign.InnerHtml += ProjectName & "<br />"
        i += 1
    Loop

I want to be able to do this, so I can build a dynamic <div> tag in an aspx page. Thanks for the help!

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 09-Dec-2005 00:27:59   

A collection is comprised of entities. So if you have a CustomerCollection you could do this

CustomerCollection customers = new CustomerCollection(); customers.GetMulti(null); foreach(CustomerEntity customer in customers) { // Do what you need to do in here }