?
Solved

Clearing a dataset before looping

Posted on 2006-06-05
2
Medium Priority
?
236 Views
Last Modified: 2010-04-23
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")?
0
Comment
Question by:hd181a
2 Comments
 
LVL 34

Accepted Solution

by:
Sancler earned 2000 total points
ID: 16837771
               ds.Tables("Field_Select_Values").Clear

will leave the structure but empty the data.

Roger
0
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 16837782
ds.Tables("Field_Select_Values").Clear()
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question