Delete all the records in a table.

Posted on 2005-04-05
Last Modified: 2010-04-23
How do I delete all the records form an ACCESS table where I have a OleDbDataAdapter  and  a Dataset ?
Question by:Mylor

    Author Comment

    and ????
    LVL 41

    Accepted Solution

    Well, that depends on what you mean by "delete"....

    If you want to delete the rows of data in your disconnected DataTable (and leave the source database alone), then a simple solution would be:


    However, if you want to delete all records in the source database, then a simple SQL command would be most efficient

            OleDbCommand.CommandText = "Delete * from Table1"

    If for some reason you need to do this with just the DataAdapter, you'd do the following

            for each dr in DataSet.Tables("Table1").Rows

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    754 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

    17 Experts available now in Live!

    Get 1:1 Help Now