MS Access: How to Clear All Data?

  • Thread starter Thread starter Mr. B
  • Start date Start date
M

Mr. B

I've an MS mdb file that I want to update the information daily.

I have to clear the columns (about 20 of them) of the hundreds of rows of the
information before I can update it (otherwise, I'm just adding to the file).

How can I do this in either VB.net or ADO.net?

Much appreciated

Bruce
 
Hi,

Fastest way is to use "TRUNCATE TABLE MyTable" SQL statement. It will delete
all the rows and leave the structure of the tables. Another way is to use
"DELETE FROM MyTable" sql statement, but it works slower
 
Val Mazur said:
Fastest way is to use "TRUNCATE TABLE MyTable" SQL statement. It will delete
all the rows and leave the structure of the tables. Another way is to use
"DELETE FROM MyTable" sql statement, but it works slower

Most excellent. I used the Delete statemment (for what it's worth. I've only
less than 500 lines so time is not an issue.

Thanks!

Bruce
 
¤ I've an MS mdb file that I want to update the information daily.
¤
¤ I have to clear the columns (about 20 of them) of the hundreds of rows of the
¤ information before I can update it (otherwise, I'm just adding to the file).
¤
¤ How can I do this in either VB.net or ADO.net?
¤
¤ Much appreciated

Just an addendum, if you are doing this on a daily basis you will periodically want to compact the
database. Otherwise it will grow to be quite large.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Just an addendum, if you are doing this on a daily basis you will periodically want to compact the
database. Otherwise it will grow to be quite large.

Right. But from what I've seen. Once I've deleted all the data, the file
actually becomes smaller. I don't know. Maybe after some time I'll see it
happening. So thanks. I'll keep an eye on the file size (which is pretty
small anyways <500k) and see if I do need to compact it or not.

Regards,

Bruce
 
Back
Top