0

Is there any way to create a button which basically clears a entire table in your database?

I was hoping to have 2 buttons, 1 to empty a table 1 to fill the same table again.
The idea is to store a year long values, and at the end of the year delete all of those with a button.
The other button i want to use to fill the same table again.
Starting from 1st day of the year untill the last day of the year.
So add a record for each day.

Found some examples, but those did not apear to work in VB2010 anymore.

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by Reverend Jim
0

Do you have a method to connect to the access database?

If not, you will have to:

1) Connect to the database (Use this for your connection string)
2) Create a new command (Use this for a simple guide on connecting to the database.)
3) Execute the command. (Use the string below to delete.)

Try something like this:

Dim sqls As String = "DELETE FROM table"

Edited by Begginnerdev

0

Yeah the database is shown on a form already.
The connection is done through Data sources.

0

oledb

i thought Truncate table only worked for SQL DB's?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.