is it possible to compact the Msaccess database using c# if so let me know the way?
You can try something like this
public static void CompactAndRepair(string accessFile, Microsoft.Office.Interop.Access.Application app)
{
string tempFile = Path.Combine(Path.GetDirectoryName(accessFile),
Path.GetRandomFileName() + Path.GetExtension(accessFile));
app.CompactRepair(accessFile, tempFile, false);
app.Visible = false;
FileInfo temp = new FileInfo(tempFile);
temp.CopyTo(accessFile, true);
temp.Delete();
}
See also Use the CompactRepair method of the Application object to compact and repair the database