Clearing a dataset before looping

Posted on 2006-06-05
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

The data for the outter loop is contained in ds as well.  How can I clear the data from ds.Tables("Field_Select_Values")?
Question by:hd181a
    LVL 34

    Accepted Solution


    will leave the structure but empty the data.

    LVL 17

    Expert Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    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 …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now