codice:
<%
' DEFINISCO LE VARIABILI CHE MI SERVONO PER L'APPLICAZIONE
Dim sc, cn, Rs, quanti, pag, contatore
' DEFINISCO LA STRINGA DI CONNESSIONE
sc = ""
sc = sc & "driver={Microsoft Access Driver (*.mdb)};dbq="
sc = sc & Server.MapPath("/db/database.mdb")
' IMPOSTO LA CONNESSIONE EDIL RECORDSET
Set cn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
' APRO LA CONNESSIONE COL DATABASE
cn.Open sc
' DEFINISCO IL NUMERO DI RECORD DA VISUALIZZARE PER OGNI PAGINA
quanti = 4
' RECUPERO IL NUMERO DI PAGINA CORRENTE
' E CONTROLLO CHE NON SIA INFERIORE A 1
pag = Request.QueryString("pag")
If IsNumeric(pag) = False Or pag < 1 Then pag = 1
' IMPOSTO UN CONTATORE
contatore = 0
%>
<div align="center">
<table cellspacing="3" cellpadding="3" width="80%" border="1" bordercolor="#C0C0C0">
<tr>
<td bgcolor="#C0C0C0" width="30%">DATA</td>
<td bgcolor="#C0C0C0" width="30%">FILE</td>
<td bgcolor="#C0C0C0" width="30%">ANTEPRIMA</td>
<td bgcolor="#C0C0C0" width="30%">AZIONI</td>
</tr>
<%
' APRO IL RECORDSET
Rs.Open "Select * from UPLOAD order by ID Desc ;", cn, 1
' EFFETTUO MATERIALMENTE LA PAGINAZIONE
Rs.PageSize = quanti
Rs.AbsolutePage = pag
' ESEGUO IL CICLO
While Rs.EOF = False And contatore < quanti
%>
<tr>
<td width="30%"><%=Rs.Fields("data")%></td>
<td width="30%"><%=Rs.Fields("titolo_file")%></td>
<td>[img]../prodotti/<%=Rs.Fields([/img]" width="70" height="70"></td>
<td align="center">Elimina</td>
<%
Rs.MoveNext
' INCREMENTO IL VALORE DEL CONTATORE
contatore = contatore + 1
Wend
%>
</table>
</div>
<%
Dim canc,objFSO
canc = Request.QueryString("canc")
If canc = true Then
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'Il file viene cancellato
objFSO.DeleteFile Server.MapPath("/prodotti/" & Rs.Fields("nome_file"))
Set objFSO = Nothing
End If
%>
<p align="center">
<%If pag > 1 Then%>
Indietro
<%End If%>
<%
Dim x
x = 1
For x = 1 To Rs.PageCount
If CInt(pag) <> x Then
%>
[<%=x%>]
<%
Else
%>
[<%=x%>]
<%
End If
Next
%>
<%If Rs.EOF = False Then%>
Avanti
<%End If%>
</p>
<table align="center" cellspacing="3" cellpadding="3" width="" border="0">
<tr>
<td align="center">
<input type="button" value="Chiudi Finestra" onClick="Chiudi()">
</td>
</tr>
</table>
</body>
</html>
<%
' UN PO DI PULIZIA...
Rs.Close
Set Rs = Nothing
cn.Close
Set cn = Nothing
%>
Guarda un po' alla riga di codice che ho marcato in rosso ...
Il recordset è 'morto' in quel punto! Rs.Fields("nome_file") non contiene un bel nulla! sei fuori dal while ... wend!
io vedrei :
e dopo, quando cancelli...
codice:
objFSO.DeleteFile Server.MapPath("/prodotti/" & Request.QueryString("nomefile"))
HTH
Zappa