Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ JAVA and C# _ Compact And Repair Access Database Using C# ?

Posted by: dongtrien Jul 29 2019, 09:28 PM

Compress and fix access data in C#, I have to look for examples on google network but it's not running examples, how to compress and fix data in C# ?

Posted by: Phil_cattivocarattere Jul 30 2019, 03:12 AM

For C# read here (I assumed you are using accdb format)
http://techieyogi.blogspot.com/2009/11/how-to-compact-access-2007-database.html
Always have a backup before doing anything (during test and production)

Posted by: dongtrien Jul 31 2019, 02:26 AM

I have seen the link you sent, the above linnk only "CompactDatabase" without "Compact and Repair Access Database"

Posted by: Phil_cattivocarattere Jul 31 2019, 03:35 AM

When you compact you also repair, it's an "all-in-one" operation.

Posted by: isladogs Jul 31 2019, 05:20 AM

Question. WHY do this in C#? Why not just do so in Access?

Posted by: dongtrien Aug 27 2019, 11:33 PM

Not where you have "Compact and Repair Access Database" separately, you see the code below, but I have not yet put the password into the code when running it will ask for a pass. How to put a password into the code ?

CODE
Microsoft.Office.Interop.Access.Application app = new Microsoft.Office.Interop.Access.Application();              
app.CompactRepair(PathFileSourceDB, PathFileDestinationDB, false);              
app.Visible = false;


Posted by: WildBird Aug 28 2019, 12:02 AM

https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/dbengine-compactdatabase-method-dao

Posted by: dongtrien Aug 28 2019, 09:41 PM

compress and fix data type I do not use DAO, if you use DAO only compression does not fix data errors