Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to compact database file?

how to compact database file?

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabasetutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _skidrow_vn_
    wrote on last edited by
    #1

    My database file (MDB) is larger day by day I want its size is small again but I don't know how to fix it :eek: it look like COMPACT DATABASE of Access Counld you help me :confused: thanks

    J M 2 Replies Last reply
    0
    • _ _skidrow_vn_

      My database file (MDB) is larger day by day I want its size is small again but I don't know how to fix it :eek: it look like COMPACT DATABASE of Access Counld you help me :confused: thanks

      J Offline
      J Offline
      jhaga
      wrote on last edited by
      #2

      What program are you using? Access 2002 has Compact and repair.. Other programs use Dump and Load... jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

      _ 1 Reply Last reply
      0
      • J jhaga

        What program are you using? Access 2002 has Compact and repair.. Other programs use Dump and Load... jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

        _ Offline
        _ Offline
        _skidrow_vn_
        wrote on last edited by
        #3

        I mean: is there a SQL statement to COMPACT DATABASE ? "Dump and Load" >>>> could you show me more detail about it? thanks

        J 1 Reply Last reply
        0
        • _ _skidrow_vn_

          I mean: is there a SQL statement to COMPACT DATABASE ? "Dump and Load" >>>> could you show me more detail about it? thanks

          J Offline
          J Offline
          jhaga
          wrote on last edited by
          #4

          There is COMPACT TABLE statement but you can not use it in Access as far as I know. Try VB/VBS/ASP/ADO like this: http://www.pstruh.cz/tips/detpg_CompactMDB.htm[^] or C++ like this: Visual C++: Compacting an Access Database via ADO Besides #import, the Msado15.dll (MDAC2.1), add the following #import statement to generate the wrapper classes for JRO to your .cpp classes (alternatively, you can generate the wrapper classes more efficiently by using the no_implementation and implementation_only attributes of the #import pre-processor statement):#import "C:\PROGRAM FILES\COMMON FILES\System\ado\MSJRO.DLL" no_namespace Add the following (specifying your own source and destination database paths) to the .cpp file where you want to compact the database:... try { IJetEnginePtr jet(__uuidof(JetEngine)); jet->CompactDatabase( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\nwind2.mdb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\abbc.mdb;" \ "Jet OLEDB:Engine Type=4"); } catch(_com_error &e) { ::MessageBox(NULL, (LPCTSTR)e.Description( ), "", MB_OK) ; } jhaga CodeProject House, Paul Watson wrote: ...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner. ...Good heavens!

          1 Reply Last reply
          0
          • _ _skidrow_vn_

            My database file (MDB) is larger day by day I want its size is small again but I don't know how to fix it :eek: it look like COMPACT DATABASE of Access Counld you help me :confused: thanks

            M Offline
            M Offline
            Martyn Pearson
            wrote on last edited by
            #5

            Given that you are using an Access database, you could use CDaoWorkspace::CompactDatabase().

            _ 1 Reply Last reply
            0
            • M Martyn Pearson

              Given that you are using an Access database, you could use CDaoWorkspace::CompactDatabase().

              _ Offline
              _ Offline
              _skidrow_vn_
              wrote on last edited by
              #6

              thank but I dont use MFC :omg: I use non-MFC and I dont know how to use DAO in non-MFC form

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups