tags:

views:

82

answers:

1

is it possible to delete all the records in a MSaccess table using c#?

+1  A: 

Yes. This page has examples for connecting to an access DB and then just use a DELETE command.

http://www.w3schools.com/aspnet/aspnet_dbconnection.asp

David Stratton
TRUNCATE is much faster
Winston Smith
@Winston Smith: does MS Access support TRUNCATE?
onedaywhen
No - No truncate in Access.
Simon
My understanding is that the Jet/ACE database engine executes "DELETE * FROM table" as a truncate, i.e., replaces the old table with an empty duplicate. I just ran ?CurrentDB.Execute "DELETE * FROM tblGBTest" on a table with 7,148,975 records and the results were instantaneous.
David-W-Fenton
@David W. Fenton: "DELETE * FROM..." -- that's a weird construct. Why not the standard "DELETE FROM..." Does adding an asterisk make it perform better?
onedaywhen