Salve a tutti ho un problema ad eliminare le foto con il seguente codice il record riesco ad eliminarlo .. potreste gentilmente aiutarmi .
codice:
<%
id_annuncio = request("id_annuncio")
Set objConn = Server.CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/public/db_db/mercatino.mdb")
objConn.Open strConn
SQL= "SELECT foto FROM messaggi WHERE id_annuncio="&id_annuncio&""
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, objConn
if not RS.eof then
file_collegato = RS("foto")
end if
RS.close
set RS = nothing
path_file="/public/foto_annunci/"
Set FileObject=CreateObject("Scripting.FileSystemObject")
dir_file=Server.MapPath(path_file)
if (FileObject.FileExists(dir_file & "/" & file_collegato)) then
FileObject.DeleteFile(dir_file & "/" & file_collegato)
end if
Set FileObject=Nothing
SQL= "DELETE * FROM messaggi WHERE id_annuncio="&id_annuncio&""
objConn.Execute SQL
%>