Forum 

Forum AspNuke.it - Il tuo Portale OpenSource in ASP

compatta i database

Autore Messaggio
emme

Amatore
Amatore
49 Discussioni



Profilo - emme
21 marzo 2003 alle 23:34:50 Profilo - emmeInvia un messaggio privato Rispondi quotando
Modificato il 17 maggio 2003 alle 12:28:09

date un'occhiata se il il procedimento e' giusto perfavore.
PS. MI RACCOMANDO DI EFFETTUARE PRIMA UN BACKUP dei DB
pagina compact.asp ....

<!-- #include file='../includes/admin/includes-inc.asp' -->
<%
sTitlePage = GetTranslation("LANG_ADMINISTRATION") & " - Compatta Database"
%>
<!-- #include file='../includes/toppage-inc.asp' -->
<%
'compatta il database dbname
Function CompactDB(dbname, password)
Dim dbpath
dbpath = Server.MapPath(GLOBAL_SITE_DATABASE_PATH & "" & dbname)

Dim cnfrom, cnto
cnfrom = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&dbpath
cnto = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&dbpath&".temp"

'se il db è protetto da password...
If password<>"" Then
cnfrom = cnfrom&";Jet OLEDB:Database Password="&password
cnto = cnto&";Jet OLEDB:Database Password="&password
End If

Dim engine
Set engine = Server.CreateObject("JRO.JetEngine")
'compatta il database
engine.CompactDatabase cnfrom, cnto

Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
'il db originale viene eliminato
fso.DeleteFile dbpath
'il db appena compresso viene rinominato col nome del db originale
fso.MoveFile dbpath&".temp", dbpath

Set fso = nothing
Set engine = nothing
End Function


If IsAuthorized(ROLE_ADMIN) Then

If Request.QueryString("compact") <> "" Then
call CompactDB(Request("compact"), "")
sInfoPage = "Database compattato correttamente"
End If

Dim fso, fld, fil, hddb(),hddbs(), x, sosta,iLine,i
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(Server.MapPath(GLOBAL_SITE_DATABASE_PATH))
i = 0
for each fil in fld.files
ReDim Preserve hddb(i)
ReDim Preserve hddbs(i)
hddb(i) = fil.name
hddbs(i) = fil.Size
i = i + 1
next
Set fso = nothing
Set fld = nothing
Set fil = nothing

CreateTopTable "Elenco", "Database"
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td>"&GetTranslation("LANG_TITLE")&"</td>" & vbCRLF
Response.Write " <td>"&GetTranslation("LANG_SIZE")&"</td>" & vbCRLF
Response.Write " <td width=""80"" align=""center"">Compatta</td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
If i > 0 Then
For i = 0 To UBound(hddb)
For x = 0 To UBound(hddb)-1
If hddb(x) > hddb(x+1) Then
sosta = hddb(x)
hddb(x) = hddb(x+1)
hddb(x+1) = sosta
End If
Next
Next
iLine = 1
for x = 0 To UBound(hddb)
Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF
Response.Write " <td>" & hddb(x) & "</td>" & vbCRLF
Response.Write " <td>" & hddbs(x) & "</td>" & vbCRLF
Response.Write " <td align=""center""><a href=""" & sURLPage & "?compact=" & hddb(x) & """><img src=""" & GLOBAL_SITE_IMAGES_PATH & "view.gif"" border=""0"" /></td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
iLine = 1 + ((iLine-1) XOR 1)
next
End If
Response.Write " <tr class=""tablelinemain"">" & vbCRLF
Response.Write " <td colspan=""3""> </td>" & vbCRLF
Response.Write " </tr>" & vbCRLF
Response.Write "</table>" & vbCRLF
CreateBottomTable ""



Else
CreateTable "Role", "", GetTranslation("LANG_MUST_HAVE_ROLE"), ""
End If
%>
<!-- #include file='../includes/bottompage-inc.asp' -->

Log in

Login
Password
Memorizza i tuoi dati:

Cerca

 

Sostieni AspNuke

Un piccolo gesto per aiutarci a mantenere AspNuke.it online

Promo

MusicWebItalia.it
Video Testi Traduzioni Spot Colonne sonore Accordi e Spartiti gratis.

Visitatori

Visitatori Correnti : 91
Membri : 0 offline Anna

Iscritti

 Utenti: 18940
Ultimo iscritto : glauco
Lista iscritti
Messaggi privati: 3373 Commenti: 2210 Immagini: 39 Downloads: 144 Articoli: 49 Pagine: 101 Siti web: 558 Notizie: 180 Sondaggi: 11 Preferiti: 5685465 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi