🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #1973

Re: [REQ] per esperti sql e VB6

#1973
From: aspidetr
Date: Sat, 13 Dec 2003 01:20
73 lines
2701 bytes
"only-offroad" <staff@only-offroad.com> ha scritto nel messaggio
news:q_Fub.42490$9_.1669744@news1.tin.it...
> -- Fante -- wrote:
> > Ciao,
> >     a quanto pare � una domanda difficile la mia perch� finora nessuno
mi ha
> > dato la "dritta" giusta:
> >
> > Quanto cancello un record da un database sql le sue dimensioni invece di
> > diminuire aumentano di poco (qualche kb) per� sono gi� a 150 MB com'�
> > possibile?
> > Esiste per caso una funzione del tipo Compatta db?
> >
> > Grazie Ricky
> >
>
> Aumenta perch� un DB Relazionale tipo SQL Server ha un file di log, in
> cui vengono registrate tutte le operazioni eseguite nel DB per un
> eventuale ripristino.
>
> Esiste l'operazione di shrink del DB gestita dalla funzione:
> object.Shrink( NewSize , Truncate )
> Leggi sui Books Online di SQL Server tutte le spiegazioni.
>
> ciao, Max
>
>


Function CompactAndRepairDatabase(DatabasePath As String, _

Optional Password As String, _

Optional TempFile As String = "c:\temp.mdb")

If DBEngine.Version < "3.6" Then DBEngine.RepairDatabase DatabasePath

'if no temp file specified, use "c:\temp.mdb"

If TempFile = "" Then TempFile = "c:\temp.mdb"


'delete temp file if it exists

If Dir(TempFile) <> "" Then Kill TempFile


'format password in form of ";pwd=PASSWORD" if password exists

If Password <> "" Then Password = ";pwd=" & Password


'compact db: a new db will be created

DBEngine.CompactDatabase DatabasePath, TempFile, , , Password


'kill first db

Kill DatabasePath


'move compacted db to original db's path

FileCopy TempFile, DatabasePath


'delete temp file

Kill TempFile

End Function
Technical Details
Message-ID: <yPtCb.186507$e6.6974255@twister2.libero.it>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.mailgate.org!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mail
References: <bpf92r$fn$1@lacerta.tiscalinet.it> <q_Fub.42490$9_.1669744@news1.tin.it>

Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII
X-Google-Thread: f94ee,7ea3210c056692eb
X-Google-Attributes: gidf94ee,public
X-Google-ArrivalTime: 2003-12-12 17:20:37 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.mailgate.org!nntp.infostrada.it!twister2.libero.it.POSTED!not-for-mail
From: "aspidetr" <aspidetr@aspidetr.com>
Newsgroups: free.it.visual-basic
References: <bpf92r$fn$1@lacerta.tiscalinet.it> <q_Fub.42490$9_.1669744@news1.tin.it>
Subject: Re: [REQ] per esperti sql e VB6
Lines: 76
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <yPtCb.186507$e6.6974255@twister2.libero.it>
Date: Sat, 13 Dec 2003 01:20:30 GMT
NNTP-Posting-Host: 151.26.6.210
X-Complaints-To: abuse@libero.it
X-Trace: twister2.libero.it 1071278430 151.26.6.210 (Sat, 13 Dec 2003 02:20:30 MET)
NNTP-Posting-Date: Sat, 13 Dec 2003 02:20:30 MET
Organization: [Infostrada]