I am trying to populate a dataset with data from a dynamic SQL dataset created by a code generator (PDSA). If I want the first row of data, or I use a specific "Where" clause to retrieve 1 row, I have no problem. But, when I loop through the dataset that has four entries, instead of getting the four entries, I get the first row 4 times. Any idea why?

Code Example:

Dim DS_C as New DS
Dim dr_A As DS_C.Tbl_ARow		        

        Me.DS_C.Tbl_A.Clear()

        Dim bo As PDSA.DataLayer.tbl_BDC = New PDSA.BusinessLayer.tbl_B

        With bo
            .ConnectionString = AppConfig.SQLConnectString
            .SelectFilter = PDSA.DataLayer.tbl_BDC.SelectFilters.All
            .WhereFilter = tbl_BDC.WhereFilters.None
            .Load()
        End With        

        For Each dr As DataRow In bo.DataSet.Tables(0).Rows

            dr_A = DS_C.Tbl_A.NewRow

            With dr_A
                .CustomerID = bo.CustomerID
                .FirstName = bo.FirstName
                .LastName = bo.LastName
                .Street = bo.Street
                .City = bo.City
                .State = bo.State
                .ZipCode = bo.ZipCode
            End With

            DS_C.Tbl_A.AddTbl_ARow(dr_A)

        Next

Using:

.CustomerID = dr("CustomerID")
.FirstName = dr("FirstName")
.LastName = dr("LastName")
.Street = dr("Street")
.City = dr("City")
.State = dr("State")
.ZipCode = dr("ZipCode")

instead of .CustomerID = bo.CustomerID etc.

did the trick!

This question has already been answered. Start a new discussion instead.