Link to home
Start Free TrialLog in
Avatar of hd181a
hd181a

asked on

Clearing a dataset before looping

The following code is inside a loop and gets executed several times

                strSql2 = "SELECT * FROM Field_Select_Values WHERE field_id = " & Row("field_id")
                da2 = New SqlDataAdapter(strSql2, conn)
                da2.Fill(ds, "Field_Select_Values")
                'set the size of the list to be the number of rows
                lstField.Rows = ds.Tables("Field_Select_Values").Rows.Count
                For Each Row2 In ds.Tables("Field_Select_Values").Rows
                    lstField.Items.Add(Row2("field_select_value"))
                Next

The data for the outter loop is contained in ds as well.  How can I clear the data from ds.Tables("Field_Select_Values")?
ASKER CERTIFIED SOLUTION
Avatar of Sancler
Sancler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ZeonFlash
ZeonFlash

ds.Tables("Field_Select_Values").Clear()