0

I am now working on converting a vb6 Application to newer vb.net technology. In the old vb6 App, they use MSAccess DAO, and i have to convert it all for it to work on SQL server - using ADO.net sqlClient.

i managed to get it done 99% but there is one more thing left.

In the old Application, they use dbengine.compactdatabase after every period of time(6 months to 1 year) to maintain the MSAccess DBes.

I wonder if there is any SQL server equivalent to DAO dbengine.compactdatabase? This program have a seperate Backup Function to backup its database, this dbengine.compactdatabase is for maintain and repair purpose.

I do not have much knowledge about DB stuff, sorry if i made a bad question. Thank you for reading.

MarioWu
  • 73
  • 1
  • 13
  • 3
    There's no reason for such a thing. SQL Server is a *server*, not a single file database like Access that needs compacting. – Panagiotis Kanavos Oct 30 '19 at 13:08
  • Thanks for the answer, yes i can just delete it. This program now can run 100% same as the old one. But it 's my curiousity, and i just want to complete this perfectly. – MarioWu Oct 30 '19 at 13:15
  • No you can't just delete the database. I *strongly* suggest you find a SQL Server course before you destroy production data. Microsoft itself offers free introductory courses and through the free Visual Studio Dev Essentials program you can get 3 months free access to Pluralsight courses. – Panagiotis Kanavos Oct 30 '19 at 13:18
  • 2
    I imagine they meant delete the obsolete command rather than the database – Martin Smith Oct 30 '19 at 13:24
  • Thank you for sugestion, and sorry for my bad English. I mean i can get rid of this dbengine.compactdatabase things and find another way to maintain databases. – MarioWu Oct 30 '19 at 13:24
  • I'm assuming `compactdatabase` is equivalent to SQL Server's Shrink database command, [this is something you really want to avoid.](https://stackoverflow.com/a/57179040/3094533) – Zohar Peled Oct 31 '19 at 11:26
  • Thank you mr.Zohar Peled, It really help me out. I thought about it before also, but as you pointed out that shrink database can cause fragmentation. I cannot take the risk, maybe i should just get rid of this feature. Thank you for your answer! – MarioWu Nov 01 '19 at 04:00

0 Answers0