Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to delete a table in access database with vb2010

$
0
0

I have found many different solutions but I am wondering, whats teh most simple way to delete all records from a access database table

And please not a solution with buttons or such, just with plain code

For accessing tables and reading them i use code like this.... so it would be nice if it could be done in the same line of commands

            '-------------------------------------------------------------------------------------------------
            'Maak een totaal datatabel voor de rekenpunten uit de database
            Dim dtWaarneempunten As New DataTable()
            'Maak een connectie met de database em vul de tabellen
            Dim conSwungDatabase As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & SwungFilePadnaam & ";Persist Security Info=False;User Id=admin;Password=;")
            conSwungDatabase.Open()
            Using cmd As New System.Data.OleDb.OleDbCommand()
                cmd.Connection = conSwungDatabase
                cmd.CommandText = "SELECT DISTINCT tblWNPflat.WNP, tblWNPflat.BAGID FROM tblWNPflat;"
                Dim rdrRekenpunt As System.Data.OleDb.OleDbDataReader = cmd.ExecuteReader()
                dtWaarneempunten.Load(rdrRekenpunt)
                Dim dvWaarneempunt As DataView = dtWaarneempunten.DefaultView
            End Using
            conSwungDatabase.Close()


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>