Jump to content
Fórum Script Brasil
  • 0

Deletar Objetos


Curry
 Share

Question

Eu montei um esquema para remover os registros do banco de dados e apagar as imgs correspondentes do servidor.. mas ele está somente deletando os registros e não apaga as ims que estão no ar:

<%
dim sqlDel, rsDel, xDel, xfed
dim objFso, strPath

xDel = request.querystring("jau")

strPath = "../fotos/"

sqlDel = " SELECT * FROM news WHERE id = " & xDel & ""

call abre_conexao

set rsDel = Conexao.execute(sqlDel)

if rsDel.EOF then

xfed = "Notícia não existente ou já excluída anteriormente."

else

sqlErs = " DELETE * FROM news WHERE id = " & xDel & ""

if rsDel("img") <> "" then
set objFso = CreateObject("Scripting.FileSystemObject")
objFso.DeleteFile strPath & rsErs("img") ,true
set objFso = nothing
end if

if rsDel("img2") <> "" then
set objFso = CreateObject("Scripting.FileSystemObject")
objFso.DeleteFile strPath & rsErs("img2") ,true
set objFso = nothing
end if

if rsDel("img3") <> "" then
set objFso = CreateObject("Scripting.FileSystemObject")
objFso.DeleteFile strPath & rsErs("img3") ,true
set objFso = nothing
end if

set rsErs = Conexao.execute(sqlErs)

xfed = "Notícia excluída com sucesso !!"

%>

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      151k
    • Total Posts
      649.1k
×
×
  • Create New...